version: '3'

services:
  strapi:
    container_name: strapi
    image: strapi/strapi
    environment:
#      - NODE_ENV=production
      - DATABASE_CLIENT=postgres
      - DATABASE_HOST=db
      - DATABASE_PORT=5432
      - DATABASE_NAME=strapi
      - DATABASE_USERNAME=strapi
      - DATABASE_PASSWORD=strapi
    ports:
      - 1337:1337
    volumes:
      - app:/srv/app
    depends_on:
      - db
#    command: 'strapi start'

  db:
    container_name: postgres
    image: postgres
    restart: always
    volumes:
      - postgresdatastrapi:/data/postgres
    environment:
      POSTGRES_USER: strapi
      POSTGRES_PASSWORD: strapi
      POSTGRES_DB: strapi
      PGDATA: /data/postgres

volumes:
  postgresdatastrapi:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_POSTGRES_STRAPI}
      o: bind

  app:
    driver: local
    driver_opts:
      type: none
      device: ${VOLUME_STRAPI_APP}
      o: bind
