Merge pull request #746 from automatisch/separate-dockerfile-for-release
Separate dockerfile for release
This commit is contained in:
@@ -3,7 +3,8 @@ services:
|
|||||||
main:
|
main:
|
||||||
build:
|
build:
|
||||||
context: ./docker
|
context: ./docker
|
||||||
image: automatischio/automatisch
|
dockerfile: Dockerfile.compose
|
||||||
|
entrypoint: /compose-entrypoint.sh
|
||||||
ports:
|
ports:
|
||||||
- '3000:3000'
|
- '3000:3000'
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -28,7 +29,8 @@ services:
|
|||||||
worker:
|
worker:
|
||||||
build:
|
build:
|
||||||
context: ./docker
|
context: ./docker
|
||||||
image: automatischio/automatisch
|
dockerfile: Dockerfile.compose
|
||||||
|
entrypoint: /compose-entrypoint.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- main
|
- main
|
||||||
environment:
|
environment:
|
||||||
@@ -52,7 +54,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
|
test: ['CMD-SHELL', 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}']
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
@@ -1,18 +1,10 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
FROM alpine
|
|
||||||
|
|
||||||
COPY ./entrypoint.sh /entrypoint.sh
|
|
||||||
|
|
||||||
RUN apk add --no-cache dos2unix && \
|
|
||||||
dos2unix /entrypoint.sh
|
|
||||||
|
|
||||||
FROM node:16-alpine
|
FROM node:16-alpine
|
||||||
WORKDIR /automatisch
|
WORKDIR /automatisch
|
||||||
|
|
||||||
COPY --from=0 /entrypoint.sh /entrypoint.sh
|
COPY ./entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
RUN apk add --no-cache openssl && yarn global add @automatisch/cli@0.2.0
|
RUN yarn global add @automatisch/cli@0.2.0
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENTRYPOINT ["sh", "/entrypoint.sh"]
|
ENTRYPOINT ["sh", "/entrypoint.sh"]
|
||||||
|
11
docker/Dockerfile.compose
Normal file
11
docker/Dockerfile.compose
Normal 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
18
docker/compose-entrypoint.sh
Executable 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
|
@@ -2,16 +2,8 @@
|
|||||||
|
|
||||||
set -e
|
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
|
|
||||||
|
|
||||||
if [ -n "$WORKER" ]; then
|
if [ -n "$WORKER" ]; then
|
||||||
automatisch start-worker --env-file /automatisch/storage/.env
|
automatisch start-worker
|
||||||
else
|
else
|
||||||
automatisch start --env-file /automatisch/storage/.env
|
automatisch start
|
||||||
fi
|
fi
|
||||||
|
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
until psql -h "$POSTGRES_HOST" -U "$POSTGRES_USERNAME" -d "$POSTGRES_DATABASE" -c '\q'; do
|
|
||||||
>&2 echo "Waiting for Postgres to be ready..."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
>&2 echo "Postgres is up - executing command"
|
|
||||||
exec "$@"
|
|
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
until psql -h "$POSTGRES_HOST" -U "$POSTGRES_USERNAME" -d "$POSTGRES_DATABASE" -c '\q'; do
|
|
||||||
>&2 echo "Waiting for Postgres to be ready..."
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
>&2 echo "Postgres is up - executing command"
|
|
||||||
exec "$@"
|
|
Reference in New Issue
Block a user