From 101fd1bb41940cd035cc2833d723f6af6b5c2869 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 16 Feb 2023 02:53:15 +0100 Subject: [PATCH] automatically rebuild when switching config, allow reuse of already built images --- deployment/.env.dist | 2 +- deployment/docker-compose.yml | 12 ++++++------ deployment/src/docker/backend.Dockerfile | 10 +++++----- deployment/src/docker/maintenance.Dockerfile | 8 ++++---- deployment/src/docker/webapp.Dockerfile | 16 ++++++++-------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/deployment/.env.dist b/deployment/.env.dist index f268ac77c..8b8901647 100644 --- a/deployment/.env.dist +++ b/deployment/.env.dist @@ -1 +1 @@ -CONFIGURATION_FOLDER=configurations/example \ No newline at end of file +CONFIGURATION=example \ No newline at end of file diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 923bd51c6..d2bb377a3 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -16,13 +16,13 @@ services: target: code webapp: - image: ocelotsocialnetwork/webapp-branded:local-production + image: ocelotsocialnetwork/webapp-branded:local-${CONFIGURATION} build: dockerfile: src/docker/webapp.Dockerfile target: branded context: . args: - - CONFIGURATION_FOLDER=$CONFIGURATION_FOLDER + - CONFIGURATION=$CONFIGURATION - APP_IMAGE_TAG_BASE=local-base - APP_IMAGE_TAG_CODE=local-code ports: @@ -59,13 +59,13 @@ services: target: code backend: - image: ocelotsocialnetwork/backend-branded:local-production + image: ocelotsocialnetwork/backend-branded:local-${CONFIGURATION} build: dockerfile: src/docker/backend.Dockerfile target: branded context: . args: - - CONFIGURATION_FOLDER=$CONFIGURATION_FOLDER + - CONFIGURATION=$CONFIGURATION - APP_IMAGE_TAG_BASE=local-base - APP_IMAGE_TAG_CODE=local-code networks: @@ -113,14 +113,14 @@ services: maintenance: # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there - image: ocelotsocialnetwork/maintenance-branded:local-production + image: ocelotsocialnetwork/maintenance-branded:local-${CONFIGURATION} build: # TODO: Separate from webapp, this must be independent dockerfile: src/docker/maintenance.Dockerfile target: branded context: . args: - - CONFIGURATION_FOLDER=$CONFIGURATION_FOLDER + - CONFIGURATION=$CONFIGURATION - APP_IMAGE_TAG_BASE=local-base - APP_IMAGE_TAG_CODE=local-code networks: diff --git a/deployment/src/docker/backend.Dockerfile b/deployment/src/docker/backend.Dockerfile index aa73e5c7d..6d458c9d7 100644 --- a/deployment/src/docker/backend.Dockerfile +++ b/deployment/src/docker/backend.Dockerfile @@ -9,13 +9,13 @@ ARG APP_IMAGE_CODE=${APP_IMAGE}:${APP_IMAGE_TAG_CODE} ################################################################################## FROM $APP_IMAGE_CODE as code -ARG CONFIGURATION_FOLDER=configurations/example +ARG CONFIGURATION=example # copy public constants and email templates into the Docker image to brand it -COPY ${CONFIGURATION_FOLDER}/branding/constants/emails.js src/config/ -COPY ${CONFIGURATION_FOLDER}/branding/constants/logos.js src/config/ -COPY ${CONFIGURATION_FOLDER}/branding/constants/metadata.js src/config/ -COPY ${CONFIGURATION_FOLDER}/branding/email/ src/middleware/helpers/email/ +COPY configurations/${CONFIGURATION}/branding/constants/emails.js src/config/ +COPY configurations/${CONFIGURATION}/branding/constants/logos.js src/config/ +COPY configurations/${CONFIGURATION}/branding/constants/metadata.js src/config/ +COPY configurations/${CONFIGURATION}/branding/email/ src/middleware/helpers/email/ ################################################################################## # BUILD ########################################################################## diff --git a/deployment/src/docker/maintenance.Dockerfile b/deployment/src/docker/maintenance.Dockerfile index 7050d1aee..1df6c551b 100644 --- a/deployment/src/docker/maintenance.Dockerfile +++ b/deployment/src/docker/maintenance.Dockerfile @@ -9,12 +9,12 @@ ARG APP_IMAGE_CODE=${APP_IMAGE}:${APP_IMAGE_TAG_CODE} ################################################################################## FROM $APP_IMAGE_CODE as code -ARG CONFIGURATION_FOLDER=configurations/example +ARG CONFIGURATION=example # copy public constants into the Docker image to brand it -COPY ${CONFIGURATION_FOLDER}/branding/static/ static/ -COPY ${CONFIGURATION_FOLDER}/branding/constants/ constants/ -COPY ${CONFIGURATION_FOLDER}/branding/locales/ locales/ +COPY configurations/${CONFIGURATION}/branding/static/ static/ +COPY configurations/${CONFIGURATION}/branding/constants/ constants/ +COPY configurations/${CONFIGURATION}/branding/locales/ locales/ ################################################################################## # BUILD ########################################################################## diff --git a/deployment/src/docker/webapp.Dockerfile b/deployment/src/docker/webapp.Dockerfile index 830779b71..ad5b7c769 100644 --- a/deployment/src/docker/webapp.Dockerfile +++ b/deployment/src/docker/webapp.Dockerfile @@ -9,17 +9,17 @@ ARG APP_IMAGE_CODE=${APP_IMAGE}:${APP_IMAGE_TAG_CODE} ################################################################################## FROM $APP_IMAGE_CODE as code -ARG CONFIGURATION_FOLDER=configurations/example +ARG CONFIGURATION=example # copy public constants into the Docker image to brand it COPY src/tools/ tools/ -COPY ${CONFIGURATION_FOLDER}/branding/static/ static/ -COPY ${CONFIGURATION_FOLDER}/branding/constants/ constants/ -COPY ${CONFIGURATION_FOLDER}/branding/locales/html/ locales/html/ -# COPY ${CONFIGURATION_FOLDER}/branding/locales/index.js locales/index.js -COPY ${CONFIGURATION_FOLDER}/branding/locales/*.json locales/tmp/ -COPY ${CONFIGURATION_FOLDER}/branding/assets/styles/imports/ assets/styles/imports/ -COPY ${CONFIGURATION_FOLDER}/branding/assets/fonts/ assets/fonts/ +COPY configurations/${CONFIGURATION}/branding/static/ static/ +COPY configurations/${CONFIGURATION}/branding/constants/ constants/ +COPY configurations/${CONFIGURATION}/branding/locales/html/ locales/html/ +# COPY configurations/${CONFIGURATION}/branding/locales/index.js locales/index.js +COPY configurations/${CONFIGURATION}/branding/locales/*.json locales/tmp/ +COPY configurations/${CONFIGURATION}/branding/assets/styles/imports/ assets/styles/imports/ +COPY configurations/${CONFIGURATION}/branding/assets/fonts/ assets/fonts/ RUN apk add --no-cache bash jq