Generate a Dockerfile that copies build output into a runtime stage
Admin ·
Use a build stage when the files you need at runtime are only part of the source tree. Set that boundary explicitly so the generated Dockerfile says which artifacts cross it.
Generate the static site recipe
Select Load static site. The build image is node:22-alpine, the build directory is /app and the build command is the JSON array for npm run build. The runtime image is nginx:1.28-alpine.
Select Generate Dockerfile. Find the stage alias build and the COPY --from=build instruction. The recipe passes /app/dist/ to /usr/share/nginx/html/.
| Setting | Generated instruction or result |
|---|---|
| Build image | FROM node:22-alpine AS build |
| Build artifact | COPY reads /app/dist/ from build |
| Runtime destination | COPY writes to /usr/share/nginx/html/ |
| Exposed TCP port | EXPOSE 80 |
Review a single-stage service
Select Load Node service. The recipe uses one FROM line and adds CMD with node and server.js as separate JSON strings.
Clear Exposed TCP port and generate again. The downloaded Dockerfile now has no EXPOSE instruction. Port publication is a runtime setting.
Review the context and explicit defaults
Open the exported Dockerfile and compare the images, paths and commands with the intended project. Both recipes start from a supplied context with COPY of the current directory.
The presets assume the lockfile and scripts named in the recipe are available. Set .dockerignore for the context and use verified image digests and dependency locks if the image must be reproducible.
Docker build contextDocker multi-stage buildsDockerfile shell and exec forms
Common questions
Can an argument contain a space or a semicolon?
Yes. Put it inside one JSON string so it stays in one argument in exec form.
How do I generate a recipe without an install step?
Clear the optional install command. The file omits that RUN line and keeps the other selected layers.