20/53
Sign inSign up free

828. The Build Runs in the Wrong Directory

easy 10 XP ~6 minHands-on lab

Labs have no container engine, so nothing is built: your files are checked by reading them.

Building chat-relay fails at the build step:

npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/package.json'

and once someone worked around that, the container crashed with Cannot find module '/dist/server.js'.

Task

Fix /home/student/projects/chat-relay/Dockerfile with WORKDIR:

  • set the working directory /app before the first COPY, and copy into it (./ or /app/),
  • no cd and no mkdir /app in any RUN,
  • npm ci and npm run build run as their own plain commands, in /app,
  • the container starts in /app with the unchanged CMD.

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.