Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vasu10134/js-docker-play
This repository contains a simple JavaScript application that has been Dockerized using Nginx. The app is built with HTML, CSS, and JavaScript, and the Dockerfile configures Nginx to serve the app inside a container. It demonstrates how to containerize a static web app and run it in a Docker environment.
https://github.com/vasu10134/js-docker-play
docker dockerimage dockerised-app
Last synced: about 1 month ago
JSON representation
This repository contains a simple JavaScript application that has been Dockerized using Nginx. The app is built with HTML, CSS, and JavaScript, and the Dockerfile configures Nginx to serve the app inside a container. It demonstrates how to containerize a static web app and run it in a Docker environment.
- Host: GitHub
- URL: https://github.com/vasu10134/js-docker-play
- Owner: Vasu10134
- License: mit
- Created: 2024-12-21T20:49:55.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-21T21:09:15.000Z (about 1 month ago)
- Last Synced: 2024-12-21T21:30:33.494Z (about 1 month ago)
- Topics: docker, dockerimage, dockerised-app
- Language: HTML
- Homepage: https://github.com/Vasu10134/js-docker-play
- Size: 0 Bytes
- Stars: 0
- 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