A clone of the classical Pac-Man game
The game runs entirely in the browser, and is served by a simple NodeJS backend which stores highscores and user stats in a MongoDB database.
npm install
npm run start
npm run dev
It assumes a mongodb server running locally. The easiest way is to use a container, e.g.:
podman run -d --name mongo -p 27017:27017 mongo:5.0.27
The Dockerfile performs the following steps:
- It uses the ubi9/nodejs-18-minimal from Red Hat as base image.
- It clones the Pac-Man game (static files and code of backend) into the configured application directory.
- It exposes port 8080 for the web server.
- It starts the Node.js application using
npm start
.
To build the image run:
podman build -t <registry>/<user>/pacman-app .
You can test it by running:
podman create --name pacman -p 8080:8080 --pod new:pacman-app <registry>/<user>/pacman-app
podman create --name mongo --pod pacman-app mongo:5.0.27
podman pod start pacman-app
This will start a mongodb instance and the pacman webapp as two container images running in the same pod.
Go to http://localhost:8000/
to see if you get the Pac-Man game.
Once you're satisfied you can push the image to the container registry.
podman push <registry>/<user>/pacman-nodejs-app
s2i build . ubi9/nodejs-18-minimal pacman
Originally written by platzh1rsch and modified by Ivan Font. You can get the original code here or the original modified version here.
NodeJS backend updated and refactored by François Charette (this repo).