Skip to content

manthanank/nodejs-docker

Repository files navigation

Nodejs Docker

A simple Node.js application containerized with Docker, featuring Express server running on port 3000.

Prerequisites

  • Node.js 18.x
  • Docker
  • npm

Project Structure

Installation

  1. Clone the repository:

    git clone https://github.com/manthanank/nodejs-docker.git
    cd nodejs-docker
  2. Install dependencies:

    npm install
  3. Start the server:

    npm start

Docker

  1. Build the Docker image:

    docker build -t nodejs-docker .
  2. Run the Docker container:

    docker run -d -p 3000:3000 nodejs-docker
  3. Open the browser and navigate to http://localhost:3000.

Docker Compose

  1. Start the application using Docker Compose:

    docker-compose up -d
  2. Open the browser and navigate to http://localhost:3000.

Testing

Currently, there are no tests specified. You can add tests by updating the test script in the package.json file and adding test files.

Continuous Integration

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

Troubleshooting

  • 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>

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Nodejs Docker

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published