tezvyn:

Writing a Dockerfile for a web app

Source: interviewbeginner

WHAT IT TESTS: core Dockerfile instructions and layering. OUTLINE: FROM a base, set WORKDIR, install dependencies before app code for cache reuse, EXPOSE the port, CMD the start command. RED FLAG: copying everything before installing deps, or root.

WHAT IT TESTS: the essential Dockerfile instructions and layer caching. ANSWER OUTLINE: choose a slim, pinned FROM base, set WORKDIR, copy the dependency manifest and install it first so that layer caches across builds, then COPY the rest of the source, EXPOSE the listening port, and define CMD or ENTRYPOINT as the start command. Mention .dockerignore and running as a non-root user. RED FLAG: copying all source before installing dependencies, breaking the cache, or using the latest tag and root.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Writing a Dockerfile for a web app · Tezvyn