diff --git a/deployment/build.docker.sh b/deployment/build.docker.sh new file mode 100755 index 000000000..23a5cce21 --- /dev/null +++ b/deployment/build.docker.sh @@ -0,0 +1,35 @@ +#!/bin/bash + + +SCRIPT_PATH=$(realpath $0) +SCRIPT_DIR=$(dirname $SCRIPT_PATH) + + +# DOCKER_BUILDKIT=0 +# TODO this must be somehow defined as service within docker-compose and build order must be defined accordingly +#services: +# basething: +# image: unimportantlocalnameusedinfromstatement +# build: +# dockerfile: src/docker/baseimage +# target: production +# context: . +# command: sleep 60 +# webapp: +# image: myimage/webapp:local-production +# depends_on: +# - basething +# build: +# dockerfile: src/docker/webapp.Dockerfile +# target: production +# context: . + +# Webapp +docker build --target base -t "ocelotsocialnetwork/webapp:local-base" $SCRIPT_DIR/../webapp/ +docker build --target code -t "ocelotsocialnetwork/webapp:local-code" $SCRIPT_DIR/../webapp/ +# Backend +docker build --target base -t "ocelotsocialnetwork/backend:local-base" $SCRIPT_DIR/../backend/ +docker build --target code -t "ocelotsocialnetwork/backend:local-code" $SCRIPT_DIR/../backend/ +# Maintenance +docker build --target base -t "ocelotsocialnetwork/maintenance:local-base" $SCRIPT_DIR/../webapp/ -f $SCRIPT_DIR/../webapp/Dockerfile.maintenance +docker build --target code -t "ocelotsocialnetwork/maintenance:local-code" $SCRIPT_DIR/../webapp/ -f $SCRIPT_DIR/../webapp/Dockerfile.maintenance \ No newline at end of file diff --git a/deployment/docker-compose.yml b/deployment/docker-compose.yml index 2eeae4ca3..108e87bd3 100644 --- a/deployment/docker-compose.yml +++ b/deployment/docker-compose.yml @@ -4,11 +4,7 @@ version: "3.4" services: - ######################################################## - # WEBAPP ############################################### - ######################################################## webapp: - # 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/webapp-branded:local-production build: dockerfile: src/docker/webapp.Dockerfile @@ -16,6 +12,8 @@ services: context: . args: - CONFIGURATION_FOLDER=$CONFIGURATION_FOLDER + - APP_IMAGE_TAG_BASE=local-base + - APP_IMAGE_TAG_CODE=local-code ports: - 3000:3000 networks: @@ -33,11 +31,7 @@ services: - INVITE_REGISTRATION=true - CATEGORIES_ACTIVE=true - ######################################################## - # BACKEND ############################################## - ######################################################## backend: - # 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/backend-branded:local-production build: dockerfile: src/docker/backend.Dockerfile @@ -45,6 +39,8 @@ services: context: . args: - CONFIGURATION_FOLDER=$CONFIGURATION_FOLDER + - APP_IMAGE_TAG_BASE=local-base + - APP_IMAGE_TAG_CODE=local-code networks: - test-network depends_on: @@ -71,12 +67,7 @@ services: - SMTP_HOST=mailserver - SMTP_PORT=25 - SMTP_IGNORE_TLS=true - # env_file: - # - .env - ######################################################## - # MAINTENANCE ########################################## - ######################################################## 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 @@ -87,6 +78,8 @@ services: context: . args: - CONFIGURATION_FOLDER=$CONFIGURATION_FOLDER + - APP_IMAGE_TAG_BASE=local-base + - APP_IMAGE_TAG_CODE=local-code networks: - test-network ports: