https://github.com/vasu10134/js-docker-play
Dockerizing JavaScript applications ensures consistent environments across development & production. It packages the app and its dependencies into containers, simplifying deployment and scaling. Docker enhances portability and security for both frontend and backend JavaScript apps. This approach integrates well with CI/CD pipelines for automation.
https://github.com/vasu10134/js-docker-play
docker docker-image javascript
Last synced: 3 months ago
JSON representation
Dockerizing JavaScript applications ensures consistent environments across development & production. It packages the app and its dependencies into containers, simplifying deployment and scaling. Docker enhances portability and security for both frontend and backend JavaScript apps. This approach integrates well with CI/CD pipelines for automation.
- Host: GitHub
- URL: https://github.com/vasu10134/js-docker-play
- Owner: Vasu10134
- License: mit
- Created: 2024-12-21T20:49:55.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-23T07:07:31.000Z (6 months ago)
- Last Synced: 2025-04-08T22:47:31.897Z (3 months ago)
- Topics: docker, docker-image, javascript
- Language: Dockerfile
- Homepage: https://github.com/Vasu10134/js-docker-play
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-docker-play
This project demonstrates how to Dockerize a simple JavaScript application and serve it using Nginx.## How It Works
The project involves creating a Docker container for a JavaScript application using the following steps:### Steps:
1. **Create a Project Directory:**
- First, create a directory for the project files.
- Inside the directory, add your JavaScript application (e.g., `index.html`, `app.js`).2. **Create a Dockerfile:**
- The `Dockerfile` contains instructions to build the Docker image:
- Start with an `nginx:alpine` base image.
- Copy the application files into the appropriate directory inside the container (`/usr/share/nginx/html`).Example `Dockerfile`:
```Dockerfile
# Use the official Nginx image as base
FROM nginx:alpine# Copy application files into the Nginx HTML directory
COPY . /usr/share/nginx/html
3. **Build the Docker Image:**
- Once the Dockerfile is ready, build the Docker image using the following command:
`docker build -t js-docker-app .`4. **Run the Docker Container:**
- Run the container in detached mode, mapping the host port to the container's port 80:
`docker run -d -p 8080:80 --name js-docker-container js-docker-app`5. **Access the Application:**
Open the browser and visit `http://localhost:8080` to view the JavaScript app served by Nginx.## Requirements
- Docker installed on your machine
- Basic knowledge of Docker and JavaScript