Building a Python + Node + pipenv + pm2 Docker Image and Automating Its Deployment
This tutorial explains how to create a Docker image that combines Python, Node.js, pipenv, and pm2, push it to Docker Hub, and set up automated builds linked to a GitHub repository for continuous integration and deployment.
When developing Python applications, using pipenv for package management and pm2 from the Node ecosystem for process monitoring is recommended; this article walks through constructing a Docker image that bundles Python, Node, pipenv, and pm2.
The Dockerfile starts from the official python:3.7 base image, installs pipenv via pip3 , adds a stable Node v10.x runtime, installs pm2 with npm , and also installs vim for convenience.
To build the image, run: docker build -t python-node:1.0.0 . The trailing dot must point to the directory containing the Dockerfile.
After the image is built, push it to Docker Hub: set a tag such as wangying/python-node:latest (where wangying is the Docker Hub username and python-node the repository name), log in with docker login , and push the image. If the repository does not exist, Docker Hub creates it automatically.
To automate future builds, link Docker Hub to a GitHub account via Account Settings → Linked Accounts , create a GitHub repository (e.g., docker-images ), and configure the repository’s Build Settings on Docker Hub to use the GitHub source. Docker Hub will then trigger a build via GitHub’s webhook whenever the Dockerfile is updated.
When building a concrete application image on top of the base image, specify the base image, set a working directory, copy project files, expose the required port, install application dependencies, and define the container’s start command using pm2-runtime with a configuration file (e.g., pm2.json or the default ecosystem.config.js ).
The article concludes that the described steps solve the core problem of constructing and automating Docker images for Python‑Node environments.
System Architect Go
Programming, architecture, application development, message queues, middleware, databases, containerization, big data, image processing, machine learning, AI, personal growth.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.