DAY 06 of 12
Pack it, door it
The same build on any machine, behind a real front door
You can do… by end of day
- Explain images vs containers, layers, and the registry.
- Write a Dockerfile and a docker-compose.yml for your stack.
- Persist SQLite data on a volume so it survives restarts.
- Configure nginx as a web server and a reverse proxy, and terminate TLS.
Deliverable
A Dockerized stack behind nginx — one compose file brings it all up.
Big-picture hook
The “APP” box is now a container, and nginx is the front door. But the door has no name yet — that's the next day.
Concepts what you'll understand
- Containers: bundle code + exact dependencies + config into an immutable image; run it as a container. Reproducible, isolated, portable.
- Dockerfile:
FROM,WORKDIR,COPY,RUN,EXPOSE,CMD— build once, run anywhere. - Volumes: the SQLite file must live on a volume or it's gone on recreate. Forgetting this = losing your data.
- Docker Compose: declare services, ports, volumes —
docker compose up -d/down. - nginx, the front door: config anatomy, server blocks (virtual hosts),
root/index/location/try_files, the safenginx -t→reloadloop. - Reverse proxy + TLS:
location /api/ { proxy_pass … }, the app hidden on localhost, and HTTPS termination at the door.
The lab hands-on, ends with something live
- Dockerize: write a Dockerfile for your Flask app and a compose file with a volume for the DB.
- Prove reproducibility:
docker compose down, thenup -d— same behavior, data intact. - nginx static vhost: serve your frontend for a host,
nginx -t, reload. - Reverse proxy: point
location /api/at the app on localhost; test the full flow.
Want this in another format? All formats