DEV Community

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

Posted on • Edited on

3 1

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.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more