version: '3'
services:
  db:
    container_name: db-project-name
    image: seasketch/geoprocessing-db
    # Port 54320 will be exposed on the host machine. For example, with
    # QGIS installed you can connect to the database on this port. Use
    # the username, password, and database name listed below.
    # If working on more than one project at a time you may want to change the 
    # exposed port number to avoid conflicts
    ports:
      - "54320:5432"
  workspace:
    container_name: workspace-project-name
    image: seasketch/geoprocessing-workspace
    # These env vars make it easy to connect to the database service
    # Use `psql` without arguments to connect from within the workspace
    environment:
      PGHOST: "db"
      PGUSER: "docker"
      PGPASSWORD: "docker"
      PGDATABASE: "gis"
    # The contents of the project directory in the host will be mirrored
    # within the workspace. 
    volumes:
      - "..:/data"
    # Switch to the data directory on startup
    working_dir: /data
    depends_on:
      - "db"
    command: ["bash"]