This project is a simple Node.js application that provides a single-page GUI using Bootstrap 4. It is designed to run in a containerized environment, either Docker or Kubernetes, and displays relevant information based on the deployment context.
- Detects whether the application is running in Docker or Kubernetes.
- Displays a greeting message with the appropriate logo.
- Shows the pod name, deployment name, and namespace when deployed on Kubernetes.
- Displays the container name when deployed on Docker.
- A footer message that welcomes users to mevijay.dev.
nodejs-container-app
├── src
│ ├── public
│ │ ├── css
│ │ │ └── styles.css
│ │ ├── js
│ │ │ └── main.js
│ │ └── index.html
│ ├── server.js
│ └── utils
│ └── container-detector.js
├── Dockerfile
├── .dockerignore
├── package.json
├── package-lock.json
└── README.md
-
Clone the repository:
git clone https://github.com/yourusername/nodejs-container-app.git cd nodejs-container-app
-
Install dependencies:
npm install
-
Run the application locally:
npm start
-
Containerize the application:
- To build the Docker image:
docker build -t nodejs-container-app .
- To run the Docker container:
docker run -p 3000:3000 nodejs-container-app
- To build the Docker image:
-
Deploy on Kubernetes:
- Create a deployment and service YAML file to deploy the application on Kubernetes.
- Access the application in your web browser at
http://localhost:3000
. - The application will display the appropriate greeting and container information based on the environment it is running in.
This project is licensed under the MIT License. See the LICENSE file for details.