Add podman compose stack
This commit is contained in:
55
compose.yaml
Normal file
55
compose.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
# Podman / Docker Compose stack for local hamprint development.
|
||||
#
|
||||
# Bring it up: podman-compose up -d (or: docker compose up -d)
|
||||
# Logs: podman-compose logs -f web
|
||||
# Tear down: podman-compose down (keeps the pgdata volume)
|
||||
# podman-compose down -v (drops the pgdata volume too)
|
||||
#
|
||||
# The `web` service uses a stock python:3.14-slim image and bind-mounts this
|
||||
# repo at /app. On every start it installs from requirements.txt plus
|
||||
# psycopg[binary] (the pip-cache volume makes subsequent starts fast) and
|
||||
# runs Django's dev server. There is intentionally no Containerfile yet --
|
||||
# swap `image:` for `build: .` once Section 10's image lands.
|
||||
|
||||
services:
|
||||
db:
|
||||
image: docker.io/library/postgres:16
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
env_file: .env
|
||||
|
||||
web:
|
||||
image: docker.io/library/python:3.14-slim
|
||||
working_dir: /app
|
||||
command: >
|
||||
bash -c "
|
||||
pip install --quiet --no-input -r requirements.txt 'psycopg[binary]' &&
|
||||
python manage.py migrate --noinput &&
|
||||
python manage.py runserver 0.0.0.0:8000
|
||||
"
|
||||
env_file: .env
|
||||
environment:
|
||||
DJANGO_SETTINGS_MODULE: hamprint.settings.dev
|
||||
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
|
||||
ports:
|
||||
- "8000:8000"
|
||||
volumes:
|
||||
- .:/app:Z
|
||||
- pipcache:/root/.cache/pip
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
pipcache:
|
||||
Reference in New Issue
Block a user