Ctrl K
ComunidadGuías…

docker-compose.yml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
services:
  nginx:
    container_name: phase-nginx
    build:
      context: .
      dockerfile: ./nginx/Dockerfile
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - frontend
      - backend
    networks:
      - phase-net

  frontend:
    container_name: phase-frontend
    restart: unless-stopped
    depends_on:
      - backend
    image: phasehq/frontend:latest
    env_file: .env
    environment:
      NEXTAUTH_URL: "${HTTP_PROTOCOL}${HOST}"
      BACKEND_API_BASE: "http://backend:8000"
      NEXT_PUBLIC_BACKEND_API_BASE: "${HTTP_PROTOCOL}${HOST}/service"
    networks:
      - phase-net

  migrations:
    container_name: phase-migrations
    image: phasehq/backend:latest
    command: python manage.py migrate
    env_file: .env
    environment:
      OAUTH_REDIRECT_URI: "${HTTP_PROTOCOL}${HOST}"
      ALLOWED_HOSTS: "${HOST},backend"
      ALLOWED_ORIGINS: "${HTTP_PROTOCOL}${HOST}"
      SESSION_COOKIE_DOMAIN: "${HOST}"
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_started
    networks:
      - phase-net

  backend:
    container_name: phase-backend
    restart: unless-stopped
    depends_on:
      migrations:
        condition: service_completed_successfully
      postgres:
        condition: service_healthy
      redis:
        condition: service_started
    image: phasehq/backend:latest
    env_file: .env
    environment:
      OAUTH_REDIRECT_URI: "${HTTP_PROTOCOL}${HOST}"
      ALLOWED_HOSTS: "${HOST},backend"
      ALLOWED_ORIGINS: "${HTTP_PROTOCOL}${HOST}"
      SESSION_COOKIE_DOMAIN: "${HOST}"
      EXTERNAL_MIGRATION: "true"
    networks:
      - phase-net

  worker:
    container_name: phase-worker
    restart: unless-stopped
    depends_on:
      migrations:
        condition: service_completed_successfully
      postgres:
        condition: service_healthy
      redis:
        condition: service_started
    image: phasehq/backend:latest
    command: python manage.py rqworker default
    env_file: .env
    environment:
      ALLOWED_HOSTS: "${HOST},backend"
      ALLOWED_ORIGINS: "${HTTP_PROTOCOL}${HOST}"
      SESSION_COOKIE_DOMAIN: "${HOST}"
    networks:
      - phase-net

  postgres:
    container_name: phase-postgres
    image: postgres:15.4-alpine3.17
    restart: always
    env_file:
      - .env
    environment:
      POSTGRES_DB: ${DATABASE_NAME}
      POSTGRES_USER: ${DATABASE_USER}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
      POSTGRES_HOST_AUTH_METHOD: "trust"
    volumes:
      - phase-postgres-data:/var/lib/postgresql/data
    networks:
      - phase-net
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USER} -d ${DATABASE_NAME}"]
      interval: 5s
      timeout: 5s
      retries: 5

  redis:
    container_name: phase-redis
    image: redis:alpine3.19
    restart: always
    networks:
      - phase-net

volumes:
  phase-postgres-data:
    driver: local

networks:
  phase-net: