canina/scripts/compose.prod.yml
parsa aghaei 501addc909
All checks were successful
Deploy Canina / deploy (push) Successful in 5m39s
fix: CI/CD pipeline, dynamic API URLs, Dockerfile fixes
- Backend Dockerfile: add chown for node_modules (Prisma permissions fix)
- Frontend Dockerfile: add ARG/ENV for NEXT_PUBLIC_API_URL, VITE_API_URL
- nginx.conf: template with __PLACEHOLDERS__ for per-env substitution
- deploy.yml: SSH keepalive, sudo for VPN
- api.ts: dynamic API URL via env vars instead of hardcoded
- next.config.ts: rewrite only in development mode
- scripts: deploy.sh, compose.stage.yml, compose.prod.yml
2026-07-28 16:37:05 +03:30

73 lines
1.9 KiB
YAML

version: '3.8'
services:
db_prod:
image: postgres:16-alpine
container_name: canino_db_prod
restart: always
environment:
POSTGRES_USER: canino_prod
POSTGRES_PASSWORD: caninopassword_prod
POSTGRES_DB: caninodb_prod
volumes:
- canina_prod_db:/var/lib/postgresql/data
networks:
- traefik_public
redis_prod:
image: redis:7-alpine
container_name: canino_redis_prod
restart: always
networks:
- traefik_public
backend_prod:
build:
context: ./backend
dockerfile: Dockerfile
container_name: canino_backend_prod
restart: always
environment:
- DATABASE_URL=postgresql://canino_prod:caninopassword_prod@db_prod:5432/caninodb_prod?schema=public
- REDIS_HOST=redis_prod
- REDIS_PORT=6379
- PORT=3000
labels:
- "traefik.enable=true"
- "traefik.http.routers.canina-api-prod.rule=Host(`api.canina.ir`)"
- "traefik.http.routers.canina-api-prod.entrypoints=websecure"
- "traefik.http.routers.canina-api-prod.tls=true"
- "traefik.http.services.canina-api-prod.loadbalancer.server.port=3000"
depends_on:
- db_prod
- redis_prod
networks:
- traefik_public
frontend_prod:
build:
context: .
dockerfile: Dockerfile
args:
NEXT_PUBLIC_API_URL: "https://api.canina.ir/api"
VITE_API_URL: "https://api.canina.ir"
container_name: canino_frontend_prod
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.routers.canina-prod.rule=Host(`canina.ir`) || Host(`admin.canina.ir`)"
- "traefik.http.routers.canina-prod.entrypoints=websecure"
- "traefik.http.routers.canina-prod.tls=true"
- "traefik.http.services.canina-prod.loadbalancer.server.port=8080"
depends_on:
- backend_prod
networks:
- traefik_public
networks:
traefik_public:
external: true
volumes:
canina_prod_db: