This repository demonstrates how to containerize a Node.js application using Docker.
This project provides a step-by-step guide on how to:
- Create a Docker image for a Node.js application
- Use Docker Compose for managing your Node.js application
- Set up proper development and production environments
- Implement best practices for Dockerizing Node.js apps
The files in this repository were uploaded from a local development environment to this GitHub repository. The README and initial repository setup were created with assistance from Claude, an AI assistant developed by Anthropic.
app/
– Node.js application source code.dockerignore
– Files and folders excluded from the Docker image build context.gitignore
– Files and folders excluded from Git version controldocker-compose.yml
– Defines and manages containers for development and production environmentsDockerfile
– Instructions for building the Docker image of the application
- Docker Desktop installed on your machine
- Basic understanding of Node.js and Docker concepts
-
Clone this repository
git clone https://github.com/BabiDoo/Dockerizing-NodeJS-Application.git
-
Navigate to the project directory
cd Dockerizing-NodeJS-Application
-
Build and run the Docker container
docker-compose up --build
-
Access the application at
http://localhost:8080
- Optimized Docker image size using multi-stage builds
- Environment variable configuration
- Volume mounting for development
- Production-ready setup
- Example of connecting to a database container
MIT
Contributions are welcome! Please feel free to submit a Pull Request.