From 9759f61e0e77fbd888e91f22c5dce14854830a1b Mon Sep 17 00:00:00 2001 From: Lauri Vuorela Date: Mon, 29 Jan 2024 01:30:26 +0100 Subject: Production target for Dockerfile (#57) * add production build * add back updates and use slim image * udpate command * ignore scripts * add workdir * fix workdirs * docker image improvements * use .example instead * use dummy data instead * remove unused env var and add comment * fix entrypoints * change name of script and add possibility for different commands * change to safer default for volume * add instructions for the dev docker container * update copy * add empty lines under topics to keep uniformity * most RUN's in a single command * add comment about volumes for dev target * remove dev workflow * remove dev workflow from readme * Prettify README --------- Co-authored-by: Sebastien Castiel --- scripts/build-image.sh | 9 ++++++++- scripts/container-entrypoint.sh | 3 +++ scripts/image-startup.sh | 5 ----- 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100755 scripts/container-entrypoint.sh delete mode 100755 scripts/image-startup.sh (limited to 'scripts') diff --git a/scripts/build-image.sh b/scripts/build-image.sh index 55ef4a4..95b8acb 100755 --- a/scripts/build-image.sh +++ b/scripts/build-image.sh @@ -3,6 +3,13 @@ SPLIIT_APP_NAME=$(node -p -e "require('./package.json').name") SPLIIT_VERSION=$(node -p -e "require('./package.json').version") -docker buildx build --no-cache -t ${SPLIIT_APP_NAME}:${SPLIIT_VERSION} -t ${SPLIIT_APP_NAME}:latest . +# we need to set dummy data for POSTGRES env vars in order for build not to fail +docker buildx build \ + --no-cache \ + --build-arg POSTGRES_PRISMA_URL=postgresql://build:@db \ + --build-arg POSTGRES_URL_NON_POOLING=postgresql://build:@db \ + -t ${SPLIIT_APP_NAME}:${SPLIIT_VERSION} \ + -t ${SPLIIT_APP_NAME}:latest \ + . docker image prune -f diff --git a/scripts/container-entrypoint.sh b/scripts/container-entrypoint.sh new file mode 100755 index 0000000..364787e --- /dev/null +++ b/scripts/container-entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash +prisma migrate deploy +npm run start diff --git a/scripts/image-startup.sh b/scripts/image-startup.sh deleted file mode 100755 index 8a3a90a..0000000 --- a/scripts/image-startup.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -prisma migrate deploy -prisma generate -npm run dev -- cgit v1.3