0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-11 01:28:30 -05:00

misc: unify develop and release docker compose files

This commit is contained in:
Andrey Antukh 2019-07-04 10:36:49 +02:00
parent 32af3adf39
commit 8cd5d10197
3 changed files with 30 additions and 129 deletions

View file

@ -1,83 +0,0 @@
version: "3"
volumes:
backend_m2:
backend_data:
db_data:
networks:
default:
driver: bridge
ipam:
config:
- subnet: 172.177.13.0/24
services:
uxdb:
image: postgres:11
# container_name: uxdb
restart: always
ports:
- 5432
environment:
- POSTGRES_INITDB_ARGS="--data-checksums"
- POSTGRES_DB=uxbox
- POSTGRES_USER=uxbox
- POSTGRES_PASSWORD=uxbox_postgres_password
volumes:
- db_data:/var/lib/postgresql/data
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
uxbackend:
image: uxbox-production-backend:latest
# container_name: uxbackend
restart: always
depends_on:
- uxdb
ports:
- 6060
volumes:
- backend_data:/srv/uxbox/resources/public
- backend_m2:/root/.m2
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
environment:
# HTTP setup
- UXBOX_HTTP_SERVER_DEBUG=false
- UXBOX_MEDIA_URI="/media/"
- UXBOX_ASSETS_URI="/static/"
# Database setup
- UXBOX_DATABASE_USERNAME="uxbox"
- UXBOX_DATABASE_PASSWORD="uxbox_postgres_password"
- UXBOX_DATABASE_NAME="uxbox"
- UXBOX_DATABASE_SERVER="uxdb"
- UXBOX_DATABASE_PORT=5432
# Mail setup
- UXBOX_EMAIL_REPLY_TO="no-reply@uxbox.io"
- UXBOX_EMAIL_FROM="no-reply@uxbox.io"
# STMP setup
- UXBOX_SMTP_HOST="localhost"
- UXBOX_SMTP_PORT=25
- UXBOX_SMTP_USER="uxbox"
- UXBOX_SMTP_PASSWORD="youshouldoverwritethiswithsomethingelse"
- UXBOX_SMTP_SSL=false
- UXBOX_SMTP_TLS=false
- UXBOX_SMTP_ENABLED=false
# Security setup
- UXBOX_SECRET="foobar"
uxfrontend:
image: uxbox-develop-frontend:latest
# container_name: uxfrontend
#hostname: uxbox.io
restart: always
depends_on:
- uxbackend
ports:
- 8081:8080
volumes:
- backend_data:/srv/uxbox/
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro

View file

@ -10,15 +10,14 @@ networks:
driver: bridge
ipam:
config:
- subnet: 172.177.12.0/24
- subnet: 172.177.10.0/24
services:
uxdb:
image: postgres:11
# container_name: uxdb
restart: always
ports:
- 5432
- 5432:5432
environment:
- POSTGRES_INITDB_ARGS="--data-checksums"
- POSTGRES_DB=uxbox
@ -70,7 +69,6 @@ services:
uxfrontend:
image: uxbox-production-frontend:latest
# container_name: uxfrontend
#hostname: uxbox.io
restart: always
depends_on:
@ -81,3 +79,16 @@ services:
- backend_data:/srv/uxbox/
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
uxfrontend-dev:
image: uxbox-develop-frontend:latest
restart: always
depends_on:
- uxbackend
ports:
- 8081:8080
volumes:
- backend_data:/srv/uxbox/
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro

View file

@ -156,22 +156,16 @@ function build-release-backend-image {
rm -rf docker/release.backend/dist || exit 1;
}
function build-release-images {
function build-images {
echo "Building frontend release image ..."
build-release-frontend-image || exit 1;
echo "Building frontend develop image ..."
build-develop-frontend-image || exit 1;
echo "Building backend release image ..."
build-release-backend-image || exit 1;
}
function build-develop-images {
echo "Building frontend develop image ..."
build-develop-frontend-image || exit 1;
echo "Building backend develop image (same as release)..."
build-release-backend-image || exit 1;
}
function run-release {
function run {
if [[ ! $(docker images uxbox-release-backend:latest) ]]; then
build-release-backend-image
fi
@ -180,21 +174,12 @@ function run-release {
build-release-frontend-image
fi
echo "Running production images..."
sudo docker-compose -p uxbox-release -f ./docker/docker-compose.yml up -d
}
function run-develop {
if [[ ! $(docker images uxbox-release-backend:latest) ]]; then
build-release-backend-image
fi
if [[ ! $(docker images uxbox-develop-frontend:latest) ]]; then
build-develop-frontend-image
fi
echo "Running develop images..."
sudo docker-compose -p uxbox-develop -f ./docker/docker-compose-develop.yml up -d
echo "Running production images..."
sudo docker-compose -p uxbox-release -f ./docker/docker-compose.yml up -d
}
function usage {
@ -208,13 +193,10 @@ function usage {
echo "- run-frontend-tests Execute unit tests for frontend only"
echo "- run-backend-tests Execute unit tests for backend only"
echo "- build-release-images Build 'production ready' docker images for both backend and frontend"
echo "- build-develop-frontend-image Build a 'develop' docker images for frontend only"
echo "- build-release-frontend-image Build a 'production ready' docker images for frontend only"
echo "- build-release-backend-image Build a 'production ready' docker images for backend only"
echo "- build-develop-images Build 'develop' docker images for both backend and frontend"
echo "- build-develop-frontend-image Build a 'develop' docker images for frontend only"
echo "- build-develop-backend-image Build a 'develop' docker images for backend only"
echo "- run-release Run 'production ready' docker images for both backend and frontend using docker compose"
echo "- run-develop Run 'develop' docker images for both backend and frontend using docker compose"
echo "- run Run 'production ready' docker images for both backend and frontend using docker compose"
}
case $1 in
@ -238,29 +220,20 @@ case $1 in
run-backend-tests
;;
build-release-images)
build-release-images
build-images)
build-images
;;
build-release-frontend-image)
build-release-frontend-image
;;
build-release-backend-image)
build-release-backend-image
;;
run-release)
run-release
;;
build-develop-images)
build-develop-images
;;
build-develop-frontend-image)
build-develop-frontend-image
;;
run-develop)
run-develop
build-release-backend-image)
build-release-backend-image
;;
run)
run
;;
*)