Week 2: A server app in a container
Week 2: A server app in a container
The static page gets a backend. You write a small Express server, package it as a container image, and let the pipeline build the image, store it in GitLab's registry and run it on your server. From here on, deploying means shipping a container.
Pushing a tag builds an image and replaces the running container on your server.
Issues
Work through the issues in order, in your own repository. Each one builds on the one before.
| Issue | What you do |
|---|---|
express-server | An Express server with two JSON routes and an automated test. |
dockerize | A Dockerfile so the app runs the same on your computer and on the server. |
provision-docker | Ansible installs Docker on the server, as it installed Caddy. |
deploy-container | CI builds and pushes the image, and the server pulls and runs it behind Caddy. |
Write the week report in report/week-2.md after the last issue.
Slide decks
Each deck is a self-study lecture of about 15–20 minutes, except the intro, which takes about five.
- Week 2 intro: what the week asks of you
- Containers: images, containers, layers and registries
- Configuration: environment variables and the twelve-factor idea
- Deploying a container: building in CI, immutable infrastructure and what a release looks like
Reading material
docs/DOCKER.mdin your repo- Docker documentation
- Dockerfile reference
- GitLab Container Registry
- The Twelve-Factor App, III. Config