Code Monkey home page Code Monkey logo

2048-game-with-container's Introduction

2048 Game Docker Deployment

Introduction

This repository contains a Dockerfile for deploying the popular 2048 game using Nginx on Ubuntu 22.04. The game source code is obtained from the 2048 GitHub repository.

Game Screenshot

Game Source

The game source code is sourced from the repository: gabrielecirulli/2048.

Dockerfile Explanation

Dockerfile

FROM ubuntu:22.04

RUN apt-get update
RUN apt-get install -y nginx zip curl

RUN echo "daemon off;" >> /etc/nginx/nginx.conf

RUN curl -o /var/www/html/master.zip -L https://github.com/gabrielecirulli/2048/archive/master.zip \
    && unzip -q /var/www/html/master.zip -d /var/www/html/ \
    && mv /var/www/html/2048-master/* /var/www/html/ \
    && rm -rf /var/www/html/2048-master /var/www/html/master.zip

EXPOSE 80

CMD ["/usr/sbin/nginx", "-c", "/etc/nginx/nginx.conf"]

Explanation

  • FROM ubuntu:22.04: Sets the base image to Ubuntu 22.04.
  • RUN apt-get update: Updates the package list.
  • RUN apt-get install -y nginx zip curl: Installs Nginx, zip, and curl.
  • RUN echo "daemon off;" >> /etc/nginx/nginx.conf: Configures Nginx to run in the foreground.
  • RUN curl -o /var/www/html/master.zip -L https://github.com/gabrielecirulli/2048/archive/master.zip \ && unzip -q /var/www/html/master.zip -d /var/www/html/ \ && mv /var/www/html/2048-master/ /var/www/html/ \ && rm -rf /var/www/html/2048-master /var/www/html/master.zip: Downloads and extracts the 2048 game source code into the Nginx default directory.
  • EXPOSE 80: Exposes port 80.
  • CMD ["/usr/sbin/nginx", "-c", "/etc/nginx/nginx.conf"]: Starts Nginx with the specified configuration file.

Deployment to AWS Elastic Beanstalk

To deploy the container to AWS Elastic Beanstalk, follow these steps:

  1. Create an Elastic Beanstalk Environment:

    • Log in to the AWS Management Console.
    • Navigate to Elastic Beanstalk.
    • Click on "Create Application" and follow the wizard to create an environment.
  2. Upload Docker Container:

    • In the Elastic Beanstalk dashboard, click on your environment.
    • In the left sidebar, navigate to "Upload and Deploy" under "Deploy" section.
    • Upload your Docker container.
  3. Configure Environment Variables:

    • Set any required environment variables.
    • Review and confirm the configuration.
  4. Deploy:

    • Click "Deploy" to start the deployment process.
  5. Access Your Application:

    • Once the deployment is successful, you can access your application using the provided URL.

Congratulations! Your 2048 game is now deployed on AWS Elastic Beanstalk.

2048-game-with-container's People

Contributors

taydinadnan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.