initialize project

Docker setup for the server, postgres and redis
This commit is contained in:
2026-04-11 18:02:14 +02:00 Unverified
commit d5ea350598
13 changed files with 360 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
services:
api:
build:
context: .
dockerfile: Dockerfile
container_name: theplug-api
restart: unless-stopped
ports:
- "${API_PORT:-8000}:8000"
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-theplug}:${POSTGRES_PASSWORD:-theplug_dev_password}@postgres:5432/${POSTGRES_DB:-theplug}
REDIS_URL: redis://redis:6379/0
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/').read()\""]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
postgres:
image: postgres:17-alpine
container_name: theplug-postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-theplug}
POSTGRES_USER: ${POSTGRES_USER:-theplug}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-theplug_dev_password}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-theplug} -d ${POSTGRES_DB:-theplug}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
redis:
image: redis:8-alpine
container_name: theplug-redis
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes"]
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
volumes:
postgres_data:
redis_data: