57 lines
1.2 KiB
YAML
57 lines
1.2 KiB
YAML
x-backend: &backend
|
|
image: cofee-backend:compute
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: prod
|
|
env_file:
|
|
- .env
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ~/storage/cofee_backend_compute_api/.certs:/app/.certs:ro
|
|
- ~/storage/cofee_backend_compute_api/.artifacts:/app/.artifacts
|
|
networks:
|
|
- services_local
|
|
|
|
services:
|
|
api:
|
|
<<: *backend
|
|
container_name: cofee_backend_compute_api
|
|
ports:
|
|
- "${API_HOST:-0.0.0.0}:${API_PORT:-8000}:8000"
|
|
healthcheck:
|
|
test: [
|
|
"CMD",
|
|
"python",
|
|
"-c",
|
|
"import urllib.request;
|
|
urllib.request.urlopen('http://localhost:8000/api/health/')",
|
|
]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
worker:
|
|
<<: *backend
|
|
container_name: cofee_backend_compute_worker
|
|
command:
|
|
[
|
|
"dramatiq",
|
|
"cpv3.modules.tasks.service",
|
|
"--processes",
|
|
"1",
|
|
"--threads",
|
|
"2",
|
|
]
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pgrep -f dramatiq || exit 1"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
networks:
|
|
services_local:
|
|
external: true
|