You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

83 lines
2.5 KiB

name: gizmoduck
x-app: &app
build: .
image: gizmoduck-local
x-runtime: &runtime
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY:?Set DJANGO_SECRET_KEY in .env}
DB_NAME: gizmoduck
DB_HOST: db
DB_USER: gizmoduck_app
DB_PASSWORD: ${RUNTIME_PASSWORD:?Set RUNTIME_PASSWORD in .env}
services:
db:
image: postgres:17
environment:
POSTGRES_DB: gizmoduck
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
MIGRATION_PASSWORD: ${MIGRATION_PASSWORD:?Set MIGRATION_PASSWORD in .env}
RUNTIME_PASSWORD: ${RUNTIME_PASSWORD:?Set RUNTIME_PASSWORD in .env}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/postgres/init.sh:/docker-entrypoint-initdb.d/10-roles.sh:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U postgres -d gizmoduck"]
interval: 2s
timeout: 3s
retries: 30
ports:
- "127.0.0.1:5432:5432"
web:
<<: *app
environment: *runtime
ports: ["127.0.0.1:8000:8000"]
depends_on:
db: {condition: service_healthy}
manage:
<<: *app
profiles: ["tools"]
environment:
<<: *runtime
DB_USER: gizmoduck_migrate
DB_PASSWORD: ${MIGRATION_PASSWORD:?Set MIGRATION_PASSWORD in .env}
volumes:
- ./imports:/app/imports
- ./exports:/app/exports
entrypoint: ["python", "manage.py"]
command: ["check"]
depends_on:
db: {condition: service_healthy}
test-db:
image: postgres:17
profiles: ["test"]
environment:
POSTGRES_DB: gizmoduck_tests
POSTGRES_PASSWORD: ${TEST_PASSWORD:?Set TEST_PASSWORD in .env}
tmpfs: [/var/lib/postgresql/data]
volumes:
- ./docker/postgres/test-init.sh:/docker-entrypoint-initdb.d/10-test.sh:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U postgres -d gizmoduck_tests"]
interval: 2s
timeout: 3s
retries: 30
test:
<<: *app
profiles: ["test"]
environment:
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY:?Set DJANGO_SECRET_KEY in .env}
DB_HOST: test-db
DB_NAME: gizmoduck_tests
DB_USER: gizmoduck_test
DB_PASSWORD: ${TEST_PASSWORD:?Set TEST_PASSWORD in .env}
command: ["pytest", "-q", "-p", "no:cacheprovider"]
depends_on:
test-db: {condition: service_healthy}
permissions:
<<: *app
profiles: ["tools"]
environment: *runtime
command: ["python", "tests/check_permissions.py"]
depends_on:
db: {condition: service_healthy}
volumes:
postgres_data: