Switch to UWSGI and make docker build/run smarter

This commit is contained in:
2022-10-18 07:22:22 +01:00
parent 5cba45e0a7
commit e121b135a2
6 changed files with 71 additions and 12 deletions

View File

@@ -4,9 +4,13 @@ services:
app:
image: xf/envelope:prod
container_name: envelope
build: .
build:
context: .
args:
OPERATION: ${OPERATION}
volumes:
- ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/uwsgi.ini:/conf/uwsgi.ini
- ${APP_DATABASE_FILE}:/conf/db.sqlite3
- app_static:${STATIC_ROOT}
#ports:
@@ -22,11 +26,17 @@ services:
condition: service_started
collectstatic:
condition: service_started
networks:
- default
- xf
migration:
image: xf/envelope:prod
container_name: migration_envelope
build: .
build:
context: .
args:
OPERATION: ${OPERATION}
command: sh -c '. /venv/bin/activate && python manage.py migrate --noinput'
volumes:
- ${PORTAINER_GIT_DIR}:/code
@@ -38,7 +48,10 @@ services:
collectstatic:
image: xf/envelope:prod
container_name: collectstatic_envelope
build: .
build:
context: .
args:
OPERATION: ${OPERATION}
command: sh -c '. /venv/bin/activate && python manage.py collectstatic --noinput'
volumes:
- ${PORTAINER_GIT_DIR}:/code
@@ -59,15 +72,17 @@ services:
hard: 65535
volumes:
- ${PORTAINER_GIT_DIR}:/code
- ${PORTAINER_GIT_DIR}/docker/nginx/conf.d:/etc/nginx/conf.d
- ${PORTAINER_GIT_DIR}/docker/nginx/conf.d/${OPERATION}.conf:/etc/nginx/conf.d/default.conf
- app_static:${STATIC_ROOT}
volumes_from:
- tmp
networks:
- default
- xf
depends_on:
app:
condition: service_started
# volumes_from:
# - tmp
# depends_on:
@@ -101,9 +116,10 @@ services:
# retries: 15
networks:
default:
external:
name: xf
default:
driver: bridge
xf:
external: true
volumes:
app_static: {}