This repository contains all the files required to a simple snake game in a docker container.
This is a snake game which can be accessed using a web browser. It's made up of a css, js, and an index.html file.
Before you get started with creating a container, create a master folder called snake-game or snake. Create two folders in this master folder and name them css and js. Move the .css and .js files to their respective folders.
Create a new folder and name it 'src' and copy the index.html and two folders into this newly created folder.
Move one directory up and download the Dockerfile at this location. At this point the master folder will have the src folder and the dockerfile.
Make sure Docker service is up and running. Build an image based on the dockerfile present in the master folder.
-t is used to name the image. Here the name is "snake-game".
Start a container using an image that's recently created.
port 80 has been used on the host and also on the container for the app to run. Change the host port to any other port as per your requirement.
Once the container is up and running, open a web browser and type in either container_ip/index.html or localhost/index.html and check the results. Click on the start button to start the snake game.
Note: The code files used in the repo were taken from an AWS twitch session about hosting a static website.