version: "3.9"
services:
  web:
    container_name: cuttowear_app
    build:
      context: ./
      dockerfile: Dockerfile
    
    image: cuttowear_app:v1
    environment:
      - PORT=8020
    env_file:
      - .env
    ports:
      - "8001:8020"
    expose:
      - 5432
    # extra_hosts:
    #   - "host.docker.internal:host-gateway"
    command: sh -c "chmod +x /app/migrate.sh && sh /app/migrate.sh && /app/entrypoint.sh"
    volumes:
      - ./static:/app/static/
      - ./media:/app/media/
    depends_on:
      - db

  db:
    container_name: cuttowear_db
    image: postgres:14
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    # env_file:
    #   - .env
    environment:
      # - POSTGRES_DB=postgres
      # - POSTGRES_USER=postgres
      # - POSTGRES_PASSWORD=postgres
      # - POSTGRES_INITDB_ARGS="--auth-host=scram-sha-256"
      - POSTGRES_DB=${DATABASE_NAME}
      - POSTGRES_USER=${DATABASE_USER}
      - POSTGRES_PASSWORD=${DATABASE_PASSWORD}

volumes:
  postgres_data: