🎉 initial commit
This commit is contained in:
109
docker-compose.yml
Normal file
109
docker-compose.yml
Normal file
@@ -0,0 +1,109 @@
|
||||
services:
|
||||
api:
|
||||
build:
|
||||
context: ./devices-api
|
||||
dockerfile: Dockerfile
|
||||
container_name: handheld-api
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./devices-api:/app
|
||||
env_file:
|
||||
- .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
- DB_HOST=postgres
|
||||
- DB_PORT=5432
|
||||
- DB_NAME=handheld_devices
|
||||
- DB_USER=devices_user
|
||||
- DB_PASSWORD=devices_password
|
||||
- REDIS_HOST=redis
|
||||
- REDIS_PORT=6379
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -q -O - http://localhost:8080/health/ready || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: handheld-postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
POSTGRES_DB: handheld_devices
|
||||
POSTGRES_USER: devices_user
|
||||
POSTGRES_PASSWORD: devices_password
|
||||
volumes:
|
||||
- ./postgres_data:/var/lib/postgresql/data
|
||||
- ./devices-api/migrations/001_create_devices.sql:/docker-entrypoint-initdb.d/001_create_devices.sql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U devices_user -d handheld_devices"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: handheld-redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
container_name: handheld-frontend
|
||||
ports:
|
||||
- "8090:8090"
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- API_URL=http://localhost:8080
|
||||
depends_on:
|
||||
api:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -q -O - http://localhost:8090/health || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 5s
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: ./devices-worker
|
||||
dockerfile: Dockerfile
|
||||
container_name: handheld-worker
|
||||
volumes:
|
||||
- ./devices-worker:/app
|
||||
env_file:
|
||||
- .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
- DB_HOST=postgres
|
||||
- DB_PORT=5432
|
||||
- DB_NAME=handheld_devices
|
||||
- DB_USER=devices_user
|
||||
- DB_PASSWORD=devices_password
|
||||
- REDIS_HOST=redis
|
||||
- REDIS_PORT=6379
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pgrep -f 'worker.lua' || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
Reference in New Issue
Block a user