A simple Node.js application containerized with Docker, featuring Express server running on port 3000.
- Node.js 18.x
- Docker
- npm
- Dockerfile - Docker container configuration
- index.js - Express server application
- package.json - Project dependencies and scripts
- .github/workflows/ci.yml - GitHub Actions CI configuration
- docker-compose.yml - Docker Compose configuration
-
Clone the repository:
git clone https://github.com/manthanank/nodejs-docker.git cd nodejs-docker
-
Install dependencies:
npm install
-
Start the server:
npm start
-
Build the Docker image:
docker build -t nodejs-docker .
-
Run the Docker container:
docker run -d -p 3000:3000 nodejs-docker
-
Open the browser and navigate to
http://localhost:3000
.
-
Start the application using Docker Compose:
docker-compose up -d
-
Open the browser and navigate to
http://localhost:3000
.
Currently, there are no tests specified. You can add tests by updating the test
script in the package.json file and adding test files.
This project uses GitHub Actions for CI. The configuration is in .github/workflows/ci.yml. The CI pipeline includes:
- Checking out the code
- Setting up Node.js
- Installing dependencies
- Running tests
- Building the Docker image
- Running the Docker container
- Verifying the Docker container is running
-
If you encounter issues with Docker, ensure Docker is running and you have the correct permissions.
-
If the application does not start, check the logs for errors:
docker logs <container_id>
This project is licensed under the MIT License - see the LICENSE file for details.