mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-03 18:22:57 +00:00
210 lines
4.9 KiB
YAML
210 lines
4.9 KiB
YAML
services:
|
|
backend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.dev
|
|
target: builder # Build only the builder stage
|
|
cache_from:
|
|
- type=local,src=/tmp/.buildx-cache
|
|
cache_to:
|
|
- type=local,dest=/tmp/.buildx-cache,mode=max
|
|
args:
|
|
BUILDKIT_INLINE_CACHE: 1
|
|
REMBG_ENABLED: ${REMBG_ENABLED:-true}
|
|
container_name: myclub-backend
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- DATABASE_URL=postgres://postgres:postgres@db:5432/fotbal_club?sslmode=disable
|
|
- JWT_SECRET=your_jwt_secret_key_here
|
|
- UPLOAD_DIR=./uploads
|
|
- PORT=8080
|
|
- RUN_MIGRATIONS=true
|
|
- SEED_DATABASE=false
|
|
- PREFETCH_TARGET=http://localhost:8080/api/v1
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./uploads:/app/uploads
|
|
- ./cache:/app/cache
|
|
working_dir: /app
|
|
command: ["./main"]
|
|
ports:
|
|
- "8080:8080"
|
|
restart: unless-stopped
|
|
networks:
|
|
- fotbal-network
|
|
dns:
|
|
- 8.8.8.8
|
|
- 8.8.4.4
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2.0'
|
|
memory: 1G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 256M
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
cache_from:
|
|
- type=local,src=/tmp/.buildx-cache-frontend
|
|
cache_to:
|
|
- type=local,dest=/tmp/.buildx-cache-frontend,mode=max
|
|
args:
|
|
BUILDKIT_INLINE_CACHE: 1
|
|
shm_size: '512m' # Increase shared memory for build
|
|
container_name: myclub-frontend
|
|
ports:
|
|
- "3000:80"
|
|
depends_on:
|
|
- backend
|
|
environment:
|
|
- REACT_APP_API_URL=http://localhost:8080/api/v1
|
|
restart: unless-stopped
|
|
networks:
|
|
- fotbal-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2.0' # Increase CPU for build performance
|
|
memory: 2G # Back to 2G for Node.js builds
|
|
reservations:
|
|
cpus: '0.25'
|
|
memory: 128M
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:80/"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
eshop-backend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.eshop.backend
|
|
container_name: myclub-eshop-backend
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- DATABASE_URL=postgres://postgres:postgres@db:5432/fotbal_club?sslmode=disable
|
|
- PORT=8080
|
|
- RUN_MIGRATIONS=false
|
|
- SEED_DATABASE=false
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./uploads:/app/uploads
|
|
- ./cache:/app/cache
|
|
networks:
|
|
- fotbal-network
|
|
ports:
|
|
- "${ESHOP_BACKEND_PORT:-8082}:8080"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/api/v1/eshop/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
profiles:
|
|
- eshop
|
|
|
|
eshop-frontend:
|
|
build:
|
|
context: ./eshop/frontend
|
|
dockerfile: Dockerfile
|
|
container_name: myclub-eshop-frontend
|
|
depends_on:
|
|
- eshop-backend
|
|
environment:
|
|
- REACT_APP_API_URL=/api/v1/eshop
|
|
ports:
|
|
- "${ESHOP_FRONTEND_PORT:-3100}:80"
|
|
restart: unless-stopped
|
|
networks:
|
|
- fotbal-network
|
|
profiles:
|
|
- eshop
|
|
|
|
db:
|
|
image: postgres:15-alpine
|
|
container_name: myclub-db
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=fotbal_club
|
|
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data/
|
|
tmpfs:
|
|
- /tmp
|
|
- /var/run/postgresql
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U postgres -d fotbal_club"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 12
|
|
start_period: 45s
|
|
networks:
|
|
- fotbal-network
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2.0'
|
|
memory: 2G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
shm_size: 256M
|
|
command:
|
|
- "postgres"
|
|
- "-c"
|
|
- "shared_buffers=256MB"
|
|
- "-c"
|
|
- "max_connections=200"
|
|
- "-c"
|
|
- "effective_cache_size=1GB"
|
|
- "-c"
|
|
- "maintenance_work_mem=128MB"
|
|
- "-c"
|
|
- "checkpoint_completion_target=0.9"
|
|
- "-c"
|
|
- "wal_buffers=16MB"
|
|
- "-c"
|
|
- "default_statistics_target=100"
|
|
- "-c"
|
|
- "random_page_cost=1.1"
|
|
- "-c"
|
|
- "effective_io_concurrency=200"
|
|
- "-c"
|
|
- "work_mem=2621kB"
|
|
- "-c"
|
|
- "min_wal_size=1GB"
|
|
- "-c"
|
|
- "max_wal_size=4GB"
|
|
- "-c"
|
|
- "fsync=on"
|
|
|
|
volumes:
|
|
postgres_data:
|
|
uploads:
|
|
|
|
networks:
|
|
fotbal-network:
|
|
driver: bridge
|