Snake game with Docker setup
  • HTML 97.1%
  • Dockerfile 2.9%
Find a file
Christian 1ac3d1a267 Initial commit: Snake game with Docker setup
- Single-file canvas Snake game (dark theme, animated food, directional eyes)
- Speed increases as score grows; high score saved in localStorage
- Dockerfile using nginx:alpine to serve the game
- docker-compose.yml mapping port 8080
- Custom nginx.conf with gzip and security headers
- README with usage instructions
2026-04-09 17:29:05 +00:00
docker-compose.yml Initial commit: Snake game with Docker setup 2026-04-09 17:29:05 +00:00
Dockerfile Initial commit: Snake game with Docker setup 2026-04-09 17:29:05 +00:00
index.html Initial commit: Snake game with Docker setup 2026-04-09 17:29:05 +00:00
nginx.conf Initial commit: Snake game with Docker setup 2026-04-09 17:29:05 +00:00
README.md Initial commit: Snake game with Docker setup 2026-04-09 17:29:05 +00:00

🐍 Snake Game

A classic Snake game served via Docker + nginx. Dark theme, canvas-based renderer, smooth gameplay, and high score persistence.

Quick Start

docker compose up --build

Then open http://localhost:8080 in your browser.

To stop:

docker compose down

With Docker only

docker build -t snake-game .
docker run -d -p 8080:80 --name snake-game snake-game

Stop and remove:

docker stop snake-game && docker rm snake-game

Controls

Key Action
↑ ↓ ← → or W A S D Move the snake
P Pause / Resume
R Restart (after game over)

Features

  • Canvas-based renderer with a dark theme
  • Smooth food glow / pulse animation
  • Snake head with directional "eyes"
  • Speed increases as you eat more food
  • High score stored in localStorage (persists across page reloads)
  • Lightweight — single HTML file, zero dependencies, served by nginx:alpine

Project Structure

snake-game/
├── index.html        # The complete game (HTML + CSS + JS)
├── Dockerfile        # nginx:alpine image
├── nginx.conf        # nginx server config (gzip, headers)
├── docker-compose.yml
└── README.md