diff --git a/docker/Dockerfile.application b/docker/Dockerfile.application index 712f257..2fe7c6c 100644 --- a/docker/Dockerfile.application +++ b/docker/Dockerfile.application @@ -12,12 +12,14 @@ RUN --mount=type=cache,target=$MAVEN_HOME/.m2,uid=$BUILD_UID \ FROM openjdk:7u211-jre-alpine AS backend RUN < $@" + if /app/entrypoint.sh tool "$*" + then + touch state/init-$stage + else + exit 1 + fi + fi +} + + cd /app if ! [ -z "$LW_CONFIGURE" ]; then @@ -26,6 +44,9 @@ fi cmd="$1" shift if [ "$cmd" == server ]; then + run_init_command import-text ImportText data/i18n-text.xml + run_init_command import-techs ImportTechs data/techs.xml + run_init_command import-buildables ImportBuildables data/buildables.xml exec /usr/bin/java \ -Dlog4j.configuration=log4j.properties \ -jar server.jar @@ -33,8 +54,9 @@ elif [ "$cmd" == shell ]; then exec /bin/sh elif [ "$cmd" == tool ]; then exec /usr/bin/java \ - -jar legacyworlds-server-main-*.jar \ - --run-tool "$*" + -Dlog4j.configuration=log4j.properties \ + -jar server.jar \ + --run-tool "$@" else echo "Invalid command '$cmd'" >&2 exit 1 diff --git a/docker/compose.yml b/docker/compose.yml index 7e01a24..5eaf8a0 100644 --- a/docker/compose.yml +++ b/docker/compose.yml @@ -25,6 +25,8 @@ services: dockerfile: docker/Dockerfile.application target: backend restart: always + volumes: + - init-state:/app/state environment: LW_CONFIGURE: 1 LW_DB_HOST: db @@ -54,6 +56,7 @@ services: volumes: database: + init-state: secrets: db_password: