DEV Community

Cover image for Dockerizing Phoenix Development (5) Scripting the images
Alastair Measures
Alastair Measures

Posted on • Edited on

Dockerizing Phoenix Development (5) Scripting the images

This extends the docker-compose.yml that appeared in step 3.

The Dockerfile (./myp_dev/docker-compose.yml)

version: "3"

volumes:
  postgis13_data:

networks:
  myp_net:

services:

  db:
    image: postgis/postgis:13-3.1-alpine
    networks:
      - myp_net
    environment:
#     - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
#     - POSTGRES_DB=postgres
    ports:
      - 5432:5432
    volumes:
      - postgis13_data:/var/lib/postgresql/data/

  web: 
    build:
      context: .
      dockerfile: Dockerfile.alpine
    networks:
      - myp_net
    ports:
      - 4000:4000
    depends_on: 
      - db
    volumes:
      - ./source:/apps

# end
Enter fullscreen mode Exit fullscreen mode

As docker-compose scripts go: this is about as simple as it gets. Even someone with a passing awareness of docker should be able to read this.

Build image from Dockerfile(s)

docker-compose --build
Enter fullscreen mode Exit fullscreen mode

Remarks

  • The system defined by this script is unlikely to conflict with other running systems; other than where it offers service on ports exposed onto the localhost.

Top comments (0)