tandoor (recipes)

version: "3.8"
services:
  # Service name: tandoor
  # The `tandoor` service definition
  tandoor:
    # Name of the container
    container_name: tandoor
    # Image to be used for the container
    image: ghcr.io/tandoorrecipes/recipes:latest
    # Container restart policy
    restart: unless-stopped
    # Volumes to be mounted to the container
    volumes:
      - /mnt/scratch/docker/data/tandoor/staticfiles:/opt/recipes/staticfiles
      - /mnt/scratch/docker/data/tandoor/mediafiles:/opt/recipes/mediafiles
    # Ports mapping between host and container
    ports:
      # Mapping port 8080 of the host to port 8080 of the container
      - 8080:8080
    # Environment variables to be passed to the container
    environment:
      - SECRET_KEY=$SECRET_KEY
      - DB_ENGINE=django.db.backends.postgresql
      - POSTGRES_HOST=tandoor-db
      - POSTGRES_PORT=5432
      - POSTGRES_USER=tandoor
      - POSTGRES_PASSWORD=$POSTGRES_PASS
      - POSTGRES_DB=tandoordb
    # Network to be used by the container
    networks:
      - tandoor_network
    # Healthcheck configuration for the container
    depends_on:
      tandoor-db:
        condition: service_healthy
  tandoor-db:
    image: postgres:15-alpine
    container_name: tandoor-db
    volumes:
      - /mnt/scratch/docker/data/tandoor/postgresql_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PORT=5432
      - POSTGRES_USER=tandoor
      - POSTGRES_PASSWORD=$POSTGRES_PASS
      - POSTGRES_DB=tandoordb
    restart: unless-stopped
    networks:
      - tandoor_network
    healthcheck:
      test:
        - CMD-SHELL
        - pg_isready
        - -d
        - tandoor
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s
# Network definitions for the tandoor application
networks:
  tandoor_network:
    driver: bridge