From 871731f874281c48d0176e9197e053e01f15ced3 Mon Sep 17 00:00:00 2001 From: Mick Vermeulen Date: Sat, 12 Sep 2020 13:38:29 +0200 Subject: [PATCH] use envsubst to automatically replace env variables in the config file --- .env.sample | 2 ++ Uchu.Dockerfile | 8 ++++---- config.xml => config.default.xml | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) rename config.xml => config.default.xml (91%) diff --git a/.env.sample b/.env.sample index d266fd4..e5f8548 100644 --- a/.env.sample +++ b/.env.sample @@ -3,6 +3,8 @@ DATABASE_PORT=5432 REDIS_PORT=6379 ADMINER_PORT=8080 DATA_FOLDER=./data + +# Change this to your local game folder GAME_FOLDER=/res # Postgres specific setup diff --git a/Uchu.Dockerfile b/Uchu.Dockerfile index 0c4033a..fbbdf63 100644 --- a/Uchu.Dockerfile +++ b/Uchu.Dockerfile @@ -1,8 +1,8 @@ FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine -ENV PATH $PATH:/root/.dotnet/tools - -COPY Uchu . -COPY config.xml . +COPY Uchu config.default.xml .env ./ +RUN apk add gettext +RUN set -o allexport && source .env && set +o allexport && envsubst < config.default.xml > config.xml RUN dotnet build + ENTRYPOINT ["dotnet", "Uchu.Master/bin/Debug/netcoreapp3.1/Uchu.Master.dll"] \ No newline at end of file diff --git a/config.xml b/config.default.xml similarity index 91% rename from config.xml rename to config.default.xml index 601206e..f810d98 100644 --- a/config.xml +++ b/config.default.xml @@ -2,10 +2,10 @@ postgres - uchu + $POSTGRES_DB db - uchu - uchu + $POSTGRES_USER + $POSTGRES_PASSWORD Debug