Dockerfile Configuration
The application uses a multi-stage Dockerfile to create an optimized container for the Node.js application.Base Image
The pipeline uses the official Node.js Alpine Linux image for a lightweight container:Base Image: Node.js version 18 on Alpine Linux
- Node.js version: 18 LTS
- OS: Alpine Linux (minimal footprint)
- Benefits: Smaller image size, faster builds, reduced attack surface
Container Configuration
Working Directory
The application files are stored in/app within the container:
File Copying and Dependencies
Exposed Ports
The internal container port where the Node.js application listens.
Application Startup
The container runs the Node.js application using:Port Mapping
When the container is deployed, the Jenkins pipeline maps ports as follows:The port accessible from outside the container (public-facing).
The port where the Node.js application runs inside the container.
Port Mapping Configuration
The deployment stage maps port 80 (external) to port 3000 (internal):- External:
http://<server-ip>:80orhttp://<server-ip> - Internal:
http://localhost:3000(within container)