allow to build locally including the ocelot image

This commit is contained in:
Ulf Gebhardt 2023-02-15 15:52:25 +01:00
parent f9fd5bfcaf
commit 34588912b1
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
2 changed files with 41 additions and 13 deletions

35
deployment/build.docker.sh Executable file
View File

@ -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

View File

@ -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: