Containerise a web app
Package a Node.js service into a small, non-root Docker image with a health check.
You'll end with: A production-style Dockerfile in your GitHub, built and tested on every push.
Do it here, in your browser
Follow the steps on the left and type in the terminal on the right. Each step ticks itself off when your files are right. At the end, one button creates the repository in your GitHub with your work, and you get a ready LinkedIn post.
Or do it on your own computer
Prefer a real terminal? Make your copy from our GitHub template, work in Codespaces or on your machine, then submit the link below.
akopslabs/build-docker-appSteps on your own computer
- 1
Make your copy
Press Start this project, keep the repository Public, and create it.
- 2
Open a Codespace
Code → Codespaces → Create codespace. Docker is already installed there.
- 3
Write the Dockerfile
Create Dockerfile in the repository root: a node:20-alpine base, copy only app/, EXPOSE 3000, a non-root USER, a HEALTHCHECK on /health, and start with node server.js. Add a .dockerignore too.
- 4
Build and run it
Check it works before you push.
docker build -t myapp . docker run -d -p 3000:3000 --name myapp myapp curl localhost:3000/health bash tests/check.sh
- 5
Push
Commit Dockerfile and .dockerignore and push. Wait for AkOps check to go green in the Actions tab.
git add Dockerfile .dockerignore git commit -m "Containerise the app" git push
- 6
Submit and share
Paste your repository link below and press Check my project.