Day 24: Complete Jenkins CI/CD Project
2048 Game Dockerized
Project Github Link:
theyashsisodiya/2048-Game (github.com)
Project Deployed Link:
http://65.2.11.33:8000/
This repository contains a Dockerized version of the popular 2048 Game.
Getting Started
To start playing the 2048 Game, follow these steps:
Clone the Repository:
git clone <repository_url>
Navigate to the Directory:
cd 2048-Game
Build the Docker Image:
docker build -t 2048-game .
Run the Docker Container:
docker run -d -p 8080:80 2048-game
Access the Game: Open your web browser and go to http://localhost:8080 to start playing the game.
Dockerfile
Here's the Dockerfile used to build the Docker image:
# Use a base image that includes Nginx web server
FROM nginx:alpine
# Set the working directory inside the container
WORKDIR /usr/share/nginx/html
# Copy all game files from the current directory to the working directory inside the container
COPY . .
# Expose port 8000 to allow access to the web server
EXPOSE 8000
# Start the Nginx web server
CMD ["nginx", "-g", "daemon off;"]
Jenkins Configuration Script
#!/bin/bash
# Path
echo "Current working directory:"
pwd
# Stop and remove the old container if it exists
echo "Stopping and removing old container..."
sudo docker stop 2048-game-container
sudo docker rm 2048-game-container
# Build the Docker image
echo "Building Docker image..."
sudo docker build -t 2048-game .
# Run the Docker container
echo "Starting the new container..."
sudo docker run -d -p 8000:80 --name 2048-game-container 2048-game
Additional Information
The Dockerfile sets up an Nginx server to serve the 2048 game.
Port 8080 on your local machine is mapped to port 80 inside the Docker container for accessing the game.
You can customize the game or server configuration by modifying the files in this repository and rebuilding the Docker image.
Enjoy playing 2048!
If you want to play that game here is the url : http://65.2.11.33:8000/
Replace <repository_url>
with the URL of your Git repository.
Subscribe to my newsletter
Read articles from Yashraj Singh Sisodiya directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Yashraj Singh Sisodiya
Yashraj Singh Sisodiya
I am Yashraj Singh Sisodiya, a 3rd Year CSE student at SVVV, born and raised in Shujalpur. Currently residing in Indore, I'm passionate about pursuing a career in DevOps engineering. My tech journey began with an internship at Infobyte, honing my skills as an Android Developer intern. Alongside my academic pursuits, I actively participate in co-curriculars, holding roles as Technical Lead at Abhyudaya and Cloud Lead at GDSC SVVV, while also serving as an MLSA of my college. I have a keen interest in Cloud Computing, demonstrated through projects such as User management and Backup using shell scripting Linux, Dockerizing applications, CI/CD with Jenkins, and deploying a 3-tier application on AWS. Always eager to learn, I'm committed to expanding my knowledge and skills in the ever-evolving tech landscape.