From cafb083ed803bd8addfa04695033857ae200e7af Mon Sep 17 00:00:00 2001 From: Sanmarg Date: Wed, 14 Jun 2023 14:31:28 +0530 Subject: [PATCH] Description: Containerised the Python game using docker and also added a bash file to build and run the docker container. On branch docker-add Changes to be committed: new file: Dockerfile new file: run-docker.sh Signed-Off: Sanmarg Sandeep Paranjpe --- Dockerfile | 22 ++++++++++++++++++++++ run-docker.sh | 21 +++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 Dockerfile create mode 100644 run-docker.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..af29fbda --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:3 + +RUN apt update -y + +LABEL Name=pythonplantsvszombies Version=0.0.1 + +RUN pip install pygame + +WORKDIR /app/ + +RUN echo "Working Directory: /app/ " + + +RUN echo "Cloning the Marblexu's Repository" + +RUN git clone https://github.com/marblexu/PythonPlantsVsZombies /app/ + +RUN echo "Almost done" + +CMD python main.py >> /dev/null + +RUN echo "Enjoy Playing!!!" diff --git a/run-docker.sh b/run-docker.sh new file mode 100644 index 00000000..022e0aa8 --- /dev/null +++ b/run-docker.sh @@ -0,0 +1,21 @@ +#bin/bash + +RED='\033[0;31m' + +GREEN='\033[0;32m' + +NC='\033[0m' + +echo -e "${GREEN}Plants VS Zombies${NC}" + +echo -e "${RED}Creating a container instance for the game...${NC}" + +xhost + + +docker build -t sanmargparanjpe/plantsvszombie . + +echo "${RED}Starting the instance...${NC}" + +docker run -it --env="DISPLAY" --net=host sanmargparanjpe/plantsvszombie + +echo "${RED}Quiting the Game${NC}" \ No newline at end of file