mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-09-20 16:07:40 +02:00
Renamed container and image names Fixed build and compose errors in Docker files Added env test and health routes to web app api Explicitly use node adapter for svelte app
122 lines
2.9 KiB
YAML
122 lines
2.9 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: open-reception-postgres
|
|
restart: unless-stopped
|
|
user: postgres
|
|
environment:
|
|
POSTGRES_DB_FILE: /run/secrets/postgres_db
|
|
POSTGRES_USER_FILE: /run/secrets/postgres_user
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
|
POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256 --auth-local=scram-sha-256"
|
|
secrets:
|
|
- postgres_db
|
|
- postgres_user
|
|
- postgres_password
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./init-db:/docker-entrypoint-initdb.d:ro
|
|
networks:
|
|
- open-reception-internal
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $$(cat /run/secrets/postgres_user) -d $$(cat /run/secrets/postgres_db)"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
cap_add:
|
|
- CHOWN
|
|
- DAC_OVERRIDE
|
|
- FOWNER
|
|
- SETGID
|
|
- SETUID
|
|
tmpfs:
|
|
- /tmp
|
|
- /var/run/postgresql
|
|
read_only: true
|
|
|
|
app:
|
|
image: open-reception:${VERSION:-latest}
|
|
container_name: open-reception-app
|
|
restart: unless-stopped
|
|
user: "1001:1001"
|
|
environment:
|
|
NODE_ENV: production
|
|
secrets:
|
|
- postgres_db
|
|
- postgres_user
|
|
- postgres_password
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
networks:
|
|
- open-reception-internal
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3000/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
tmpfs:
|
|
- /tmp
|
|
command: >
|
|
sh -c "
|
|
export POSTGRES_DB=$$(cat /run/secrets/postgres_db)
|
|
export POSTGRES_USER=$$(cat /run/secrets/postgres_user)
|
|
export POSTGRES_PASSWORD=$$(cat /run/secrets/postgres_password)
|
|
export DATABASE_URL=\"postgres://$$POSTGRES_USER:$$POSTGRES_PASSWORD@postgres:5432/$$POSTGRES_DB\"
|
|
exec node build/index.js
|
|
"
|
|
read_only: true
|
|
|
|
caddy:
|
|
image: caddy:2-alpine
|
|
container_name: open-reception-caddy
|
|
restart: unless-stopped
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
|
- caddy_data:/data
|
|
- caddy_config:/config
|
|
networks:
|
|
- open-reception-internal
|
|
depends_on:
|
|
app:
|
|
condition: service_healthy
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
cap_add:
|
|
- NET_BIND_SERVICE
|
|
|
|
secrets:
|
|
postgres_db:
|
|
file: ./secrets/postgres_db.txt
|
|
postgres_user:
|
|
file: ./secrets/postgres_user.txt
|
|
postgres_password:
|
|
file: ./secrets/postgres_password.txt
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
caddy_data:
|
|
driver: local
|
|
caddy_config:
|
|
driver: local
|
|
|
|
networks:
|
|
open-reception-internal:
|
|
driver: bridge
|
|
internal: false |