refactor(docker-compose): incorporate standalone build

This commit is contained in:
Ali BARIN
2022-11-27 01:36:48 +01:00
parent e455497596
commit a0f0db1dd4
3 changed files with 34 additions and 3 deletions

11
docker/Dockerfile.compose Normal file
View File

@@ -0,0 +1,11 @@
# syntax=docker/dockerfile:1
FROM automatischio/automatisch:0.2.0
WORKDIR /automatisch
RUN apk add --no-cache openssl dos2unix
COPY ./compose-entrypoint.sh /compose-entrypoint.sh
RUN dos2unix /compose-entrypoint.sh
EXPOSE 3000
ENTRYPOINT ["sh", "/compose-entrypoint.sh"]

18
docker/compose-entrypoint.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
set -e
if [ ! -f /automatisch/storage/.env ]; then
>&2 echo "Saving environment variables"
ENCRYPTION_KEY="${ENCRYPTION_KEY:-$(openssl rand -base64 36)}"
APP_SECRET_KEY="${APP_SECRET_KEY:-$(openssl rand -base64 36)}"
echo "ENCRYPTION_KEY=$ENCRYPTION_KEY" >> /automatisch/storage/.env
echo "APP_SECRET_KEY=$APP_SECRET_KEY" >> /automatisch/storage/.env
fi
# initiate env. vars. from /automatisch/storage/.env file
export $(grep -v '^#' /automatisch/storage/.env | xargs)
echo "Environment variables have been set!"
sh /entrypoint.sh