services:
  db_recipes:
    restart: always
    image: postgres:16-alpine
    volumes:
      - postgresql:/var/lib/postgresql/data
    env_file:
      - .env
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 500M

  web_recipes:
    restart: always
    image: vabene1111/recipes
    ports:
      - "2295:2295"
      # - "5432:5432"
    env_file:
      - .env
    volumes:
      - ./staticfiles:/opt/recipes/staticfiles
      - ./mediafiles:/opt/recipes/mediafiles
    depends_on:
      - db_recipes
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 1000M

volumes:
  staticfiles:
  postgresql:

networks:
  web:
    driver: bridge
