Skip to content

yetmike/docker-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Tutorial

Three runnable sample apps (Python, Go, Rust) — each demonstrating a different level of Docker packaging.

Every subproject has its own mise.toml pinning the exact toolchain. Run mise install inside any subproject to provision its runtime.


Layout

docker-tutorial/
├── flask-app/      Python Flask + Redis                     (mise: python 3.12)
├── go-app/         Go + Postgres                            (mise: go 1.22)
└── rust-app/       Rust HTTP server                         (mise: rust stable)

The three Docker patterns

Project Pattern What it teaches
flask-app Dockerfile + Compose Single-stage image for an interpreted runtime; Compose wires Flask to Redis
go-app Multi-stage + Compose Builder → distroless tiny image; Compose adds Postgres
rust-app Multi-stage, no Compose Rust builder → debian-slim; .dockerignore keeps target/ out; plain docker build/run

Prerequisites

  • mise (already installed)
  • Docker with the Compose plugin

flask-app — Dockerfile + Compose

cd flask-app
docker compose up --build
# → http://localhost:5000       (visit counter backed by Redis)
# → http://localhost:5000/health

docker compose down

Run locally (no Docker):

mise install            # provisions python 3.12
pip install -r requirements.txt
python app.py

go-app — Multi-stage + Compose

cd go-app
docker compose up --build
# → http://localhost:8080       (Postgres connectivity check)
# → http://localhost:8080/health

# Check how small the final image is (no Go toolchain inside):
docker images go-app-app

docker compose down

Run locally (no Docker):

cd go-app
mise install            # provisions go 1.22
go mod download
go run .

rust-app — Multi-stage Dockerfile only

cd rust-app
docker build -t rust-app .
docker run --rm -p 3000:3000 rust-app
# → http://localhost:3000
# → http://localhost:3000/health

Run locally (no Docker):

mise install            # provisions rust stable
cargo run

Further reading

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors