version: '3.4'

services:
  web_prod:
    restart: always
    build:
      context: .
      dockerfile: Dockerfile.prod
    env_file: .env.prod
    environment:
      POSTGRES_PORT: 5433
    volumes:
      - type: volume
        source: web-media
        target: /app/media
        volume:
          nocopy: true
      - type: volume
        source: web-static
        target: /app/static
    expose:
      - "8080"
    stdin_open: true
    tty: true
    depends_on:
      - db_prod
      - cache_prod
  nginx:
    restart: always
    build:
      context: .
      dockerfile: config/nginx/Dockerfile
    image: nginx/latest
    ports:
      - "81:80"
    volumes:
      - web-static:/srv/static
      - web-media:/srv/media
      - web-files:/srv/files
      - web-releases:/srv/releases
    depends_on:
      - web_prod
  db_prod:
    restart: always
    image: postgres:11
    ports:
      - 5433:5432
    volumes:
      - postgresql:/var/lib/postgresql/data
    env_file: .env.prod
  cache_prod:
    restart: always
    image: redis:latest
    expose:
      - "6379"
    volumes:
      - redisdata:/data

volumes:
  postgresql:
  web-media:
  web-static:
  web-files:
  web-releases:
  redisdata:

version: '3.4'

services:
  web_prod:
    restart: always
    build:
      context: .
      dockerfile: Dockerfile.prod
    env_file: .env.prod
    environment:
      POSTGRES_PORT: 5433
    volumes:
      - type: volume
        source: web-media
        target: /app/media
        volume:
          nocopy: true
      - type: volume
        source: web-static
        target: /app/static
    expose:
      - "8080"
    stdin_open: true
    tty: true
    depends_on:
      - db_prod
      - cache_prod
  nginx:
    restart: always
    build:
      context: .
      dockerfile: config/nginx/Dockerfile
    image: nginx/latest
    ports:
      - "81:80"
    volumes:
      - web-static:/srv/static
      - web-media:/srv/media
      - web-files:/srv/files
      - web-releases:/srv/releases
    depends_on:
      - web_prod
  db_prod:
    restart: always
    image: postgres:12
    ports:
      - 5433:5432
    volumes:
      - postgresql:/var/lib/postgresql/data
    env_file: .env.prod
  cache_prod:
    restart: always
    image: redis:latest
    expose:
      - "6379"
    volumes:
      - redisdata:/data

volumes:
  postgresql:
  web-media:
  web-static:
  web-files:
  web-releases:
  redisdata:

Update Postgres to version 12
Update Postgres to version 12
