docker-compose/41-compose-nginx-app-postgres/docker-compose.yml
services:
nginx:
image: nginx:alpine
ports: ["8080:80"]
volumes: ["./nginx.conf:/etc/nginx/conf.d/default.conf:ro"]
depends_on: [app]
app:
image: hashicorp/http-echo
command: ["-text=hello from app"]
expose: ["5678"]
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: appdb
POSTGRES_USER: appuser
POSTGRES_PASSWORD: ${DEMO_DB_PASSWORD:?Set DEMO_DB_PASSWORD}
volumes: ["postgres_data:/var/lib/postgresql/data"]
volumes:
postgres_data: