version: '3'

services:
  mainnetwork:
    ports:
      - "80:80"
      - "8080:8080" # for webpack HMR
      - "8081:8081" # for webpack HMR
      - "8082:8082" # snakeviz
  web:
    build:
      context: .
      dockerfile: Dockerfile-dev
  reports:
    build:
      context: .
      dockerfile: Dockerfile-dev
    volumes:
      - .:/var/akvo/rsr/code:delegated
      - ./scripts/docker/dev/50-docker-local-dev.conf:/config_overrides/50-docker-local-dev.conf
      - /var/akvo/rsr/code/src/
    network_mode: service:mainnetwork
    environment:
      - DJANGO_SECRET_KEY=secretkey
      - IS_REPORTS_CONTAINER=yes
      - DJANGO_PORT=9000
  nginx:
    image: nginx:1.17.9-alpine
    network_mode: service:mainnetwork
    volumes:
      - ./scripts/docker/dev/nginx:/etc/nginx/conf.d
  rsrdbhost:
    ports:
      - "5432:5432"

version: '3'

services:
  mainnetwork:
    ports:
      - "80:80"
      - "8080:8080" # for webpack HMR
      - "8081:8081" # for webpack HMR
      - "8082:8082" # snakeviz
  web:
    build:
      context: .
      dockerfile: Dockerfile-dev
    entrypoint: scripts/docker/dev/run-as-user.sh
    command: scripts/docker/dev/start-django.sh
  reports:
    build:
      context: .
      dockerfile: Dockerfile-dev
    volumes:
      - .:/var/akvo/rsr/code:delegated
      - ./scripts/docker/dev/50-docker-local-dev.conf:/config_overrides/50-docker-local-dev.conf
      - /var/akvo/rsr/code/src/
    network_mode: service:mainnetwork
    environment:
      - DJANGO_SECRET_KEY=secretkey
      - IS_REPORTS_CONTAINER=yes
      - DJANGO_PORT=9000
  nginx:
    image: nginx:1.17.9-alpine
    network_mode: service:mainnetwork
    volumes:
      - ./scripts/docker/dev/nginx:/etc/nginx/conf.d
  rsrdbhost:
    ports:
      - "5432:5432"

Support remote debugging with PyCharm Professional
chore: Support remote debugging with PyCharm Professional

PyCharm overrides the command for the web container and doesn't touch the entrypoint.
The `Dockerfile-dev` only sets the `COMMAND`.

`run-as-user.sh` is required in order for the correct environment to exist when running commands,
 so it fits well as the entrypoint to support other commands

#4652 Support remote debugging with PyCharm Professional
