Added dockerfile and entrypoint

This commit is contained in:
Rachel Sanders
2015-09-18 14:22:17 -07:00
parent feaa7a26d5
commit 3d6dd2c1ad
2 changed files with 77 additions and 0 deletions

20
Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
from ubuntu:14.04
RUN apt-get -y update
RUN apt-get install -yf \
openjdk-7-jdk \
mysql-server \
scala
RUN mkdir /etc/hackpad
VOLUME /etc/hackpad/src
COPY bin/docker-entrypoint.sh /etc/hackpad/
ENTRYPOINT ["/etc/hackpad/docker-entrypoint.sh"]
EXPOSE 9000
CMD ["hackpad"]

57
bin/docker-entrypoint.sh Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
set -e
HACKPAD_SRC="/etc/hackpad/src"
if [ "$1" = 'hackpad' ]; then
if [ ! -d "$HACKPAD_SRC" ]; then
echo "The directory $HACKPAD_SRC doesn't exist."
echo "Either your docker image is broken (rebuild from scratch if so) or you're running this script on the host machine and should stop it."
exit 1
fi
cd "$HACKPAD_SRC"
if [ ! -f "$HACKPAD_SRC/README.md" ]; then
echo "I can't find any hackpad source files. Did you forget to mount the volume?"
echo "[insert instructions here]"
exit 1
fi
echo "-->Editing configuration files"
sed 's:^export SCALA_HOME=".*$:export SCALA_HOME="/usr/share/java":' -i '' bin/exports.sh
sed 's:^export SCALA_LIBRARY_JAR=".*$:export SCALA_LIBRARY_JAR="$SCALA_HOME/scala-library.jar":' -i '' bin/exports.sh
sed 's:^export JAVA_HOME=".*$:export JAVA_HOME="/usr/share/java":' -i '' bin/exports.sh
cp etherpad/etc/etherpad.localdev-default.properties etherpad/etc/etherpad.local.properties
sed 's:__email_addresses_with_admin_access__:admin@localhost.info:' -i '' etherpad/etc/etherpad.local.properties
echo "-->Running build"
./bin/build.sh
echo "-->Starting mysql"
service mysql restart
echo "-->Creating database"
./contrib/scripts/setup-mysql-db.sh -p ""
echo
echo "Starting server. A fake admin account has been created, use admin@localhost.info"
echo
./bin/run.sh
elif [[ "$1" = 'server' ]]; then
echo
echo "Starting server."
echo
./bin/run.sh
fi
exec "$@"