8/53
Sign inSign up free

425. Order a Dockerfile for the Build Cache

easy 10 XP ~5 minHands-on lab100% acceptance

Labs have no container engine, so nothing is built or started: your files are checked by reading them, the way a reviewer or a CI linter would. docker-compose config (to validate Compose files) and hadolint (a Dockerfile linter) are installed.

Every code change to /home/student/projects/invoice-pdf makes CI reinstall all npm packages, which takes four minutes.

Task

Reorder /home/student/projects/invoice-pdf/Dockerfile so that the dependency install is cached until the dependencies change:

  • copy only package.json and package-lock.json, then run npm ci --omit=dev
  • copy the rest of the source after that
  • keep the same base image, working directory, exposed port and start command

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.