# This docker-compose file contains only Postgres database for local run. 
# Strapi should be run either in a separate container (Dockerfile) or in the host machine (yarn dev).

name: dev-templates
services:
  db:
    platform: linux/amd64 #for platform error on Apple M1 chips
    restart: unless-stopped
    env_file: .env
    image: postgres:16.0-alpine
    environment:
      POSTGRES_USER: ${DATABASE_USERNAME}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
      POSTGRES_DB: ${DATABASE_NAME}
    volumes:
      - data:/var/lib/postgresql/data/ #using a volume
      #- ./data:/var/lib/postgresql/data/ # if you want to use a bind folder
    ports:
      - "5432:5432"
    networks:
      - db_network

volumes:
  data:

networks:
  db_network:
    driver: bridge