version: '3.4'
services:
  db:
    image: postgres:12
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
    environment:
      - POSTGRES_PASSWORD=postgres
    ports:
      - 5432:5432
    volumes:
      - dbdata:/var/lib/postgresql/data

  backend:
    image: registry.gitlab.com/sahkoinsinoorikilta/vtmk/web2.0-backend:latest
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
      update_config:
        order: start-first
    depends_on:
      - db
    ports:
      - 8000:8000

    environment:
      - HOST=api.dev.sik.party
      - DEBUG=True
      - SECRET_KEY=7p$85^4ibb^p4-=vs44b7!y0e-zemugze18@a#30&71=a8)dp(
      - EMAIL_PASSWD_FILE=/run/secrets/DJANGO_EMAIL_PASSWD

    secrets:
      - DJANGO_EMAIL_PASSWD
secrets:
  DJANGO_EMAIL_PASSWD:
    external: true

volumes:
  dbdata:
