This Dockerfile allows you to containerize the popular 2048 game using Nginx as the web server. Follow the instructions below to create a Docker image and deploy it to Amazon Elastic Beanstalk.
Make sure you have the following installed on your system:
- Docker: Get Docker
- AWS CLI: Install AWS CLI
- Elastic Beanstalk CLI: Install EB CLI
-
Clone the repository containing the Dockerfile:
git clone https://github.com/fernandomarins/2048-game
-
Navigate to the directory containing the Dockerfile:
cd your/repo
-
Build the Docker image:
docker build -t 2048-game .
-
Run the Docker container locally:
docker run -p 80:80 2048-game
-
Open your web browser and navigate to http://localhost:80 to play the 2048 game.
-
Log in to your AWS account using the AWS CLI:
aws configure
-
Initialize Elastic Beanstalk in your project directory:
eb init -p docker
-
Create an environment and deploy the application:
eb create 2048-environment
-
Access your deployed application:
eb open
-
Finish your deployed application:
eb terminate 2048-environment
After testing, don't forget to stop and remove the local Docker container:
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)