A laptop, a phone and a hand writing in a notebook on a wooden desk, banner image on the Dockerfile Builder page

Werkzeuge / Build suite

Dockerfile Builder

Generate a production-grade Dockerfile for your stack: multi-stage, non-root, cached layers

Pick the stack, answer four questions, get a Dockerfile with the practices people paste from blog posts: multi-stage builds, layer caching, non-root user, healthcheck.

Open the tool
Screenshot of the Dockerfile Builder tool

What it does

A Dockerfile with the boring parts right.

Stack-aware stages

Node, Python, Go and static-site presets with the right base images, build stages and runtime stages.

Cache-friendly layering

Dependency manifests copy before source, so rebuilds only redo what changed.

Non-root by default

Every generated file runs as an unprivileged user, with the ownership lines people forget.

Healthcheck and .dockerignore

A working HEALTHCHECK plus a .dockerignore that keeps secrets and node_modules out of the image.

How it works

Pick, answer, copy.

Step 1

Choose the stack and package manager.

Step 2

Set the port, start command and build command.

Step 3

Copy the Dockerfile and .dockerignore.

FAQ

Which base images?

Official images with pinned majors: node:22-slim, python:3.13-slim, golang:1.23, nginx:1.27.

Compose too?

The Dockerfile is the deliverable; a compose service snippet is included in the output comments.

Multi-arch?

The generated file is architecture-neutral; buildx handles the rest.

Open Dockerfile Builder

Worked example

Real output, from the tool itself.

This is what Dockerfile Builder returned for its built-in example input, captured from the tool - not a mockup.

You enter

Runtime

node

Port

3000

Install

npm ci

Build

npm run build

Start command

node server.js

Health path

/healthz

The tool returns

# syntax=docker/dockerfile:1

FROM node:22-slim AS deps
WORKDIR /app
COPY package*.json ./
RUN mkdir -p node_modules && npm ci

FROM node:22-slim AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build

FROM node:22-slim AS runtime
ENV NODE_ENV=production
WORKDIR /app
Try it with your own input

More in the Build suite

Font Pairing LabWebhook TesterPricing Page BuilderLanding Page MakerStatus Page Starter
A laptop, headphones, a camera, a phone and a plant on a white desk, seen from above, banner image on the Dockerfile Builder page

Try it now.

Dockerfile Builder runs in your browser. No account needed.

Authored Tiles

Six inputs

RuntimePortInstall commandBuild commandStart commandHealth path
RuntimePortInstall commandBuild commandStart commandHealth path
The fields that shape the Dockerfile.

Authored Tiles

Four runtimes

Node.jsPythonGoStatic site (nginx)
Node.jsPythonGoStatic site (nginx)
The runtime picker.

Bar Compare

Build stages per runtime

Node.js3 stagesPython2 stagesGo2 stagesStatic site2 stages
Node.js3 stagesPython2 stagesGo2 stagesStatic site2 stages
Each runtime builds in a set number of stages.

Pipeline

Node.js stages

deps: installpackagesbuild: copy sourceand buildruntime: copy theresultRun as the appuser
deps: install packagesbuild: copy source and buildruntime: copy the resultRun as the app user
Dependencies, build and a small runtime stage.

Pipeline

Python stages

deps: pip installCopy site-packagesacrossCopy your codeRun as the appuser
deps: pip installCopy site-packages acrossCopy your codeRun as the app user
Packages are installed once, then copied into the runtime.

Pipeline

Go stages

Download modulesBuild with CGOdisabledCopy the binaryRun on adistroless nonrootbase
Download modulesBuild with CGO disabledCopy the binaryRun on a distroless nonroot base
A full compiler builds the binary, a tiny image runs it.

Pipeline

Static site stages

Install and buildCopy dist to nginxWrite the serverruleServe on your port
Install and buildCopy dist to nginxWrite the server ruleServe on your port
Node builds the files, nginx serves them.

Authored Tiles

Base images chosen

node:22-slimpython:3.13-slimgolang:1.23distroless static nonroot,and nginx:1.27-alpine
node:22-slimpython:3.13-slimgolang:1.23distroless static nonroot, andnginx:1.27-alpine
The images the tool writes into FROM lines.

Before After

Run as a non-root user

Dockerfile linesEffectCreate group appCreate user appUSER appProcess is not rootFiles owned by appSmaller blast radius
Dockerfile lines to EffectCreate group appProcess is not rootCreate user appFiles owned by appUSER appSmaller blast radius
Node and Python create an app user; Go uses nonroot.

Pipeline

Cache-friendly copy order

Copy package filesInstalldependenciesCopy the rest ofthe sourceEdits skip theinstall layer
Copy package filesInstall dependenciesCopy the rest of the sourceEdits skip the install layer
Package files are copied before the source so installs are cached.

Input To Output

Port wiring

Port 3000EXPOSE lineHealth checkURLnginx listenruleBuilderInOut
InPort 3000BuilderEXPOSE lineHealth check URLnginx listen ruleOut
One port value is used in several places.

Authored Tiles

Default values

Default port3000
Default port3000
The tool starts with these settings.

Pipeline

Health checks differ by runtime

Node: fetch theURLPython: urllibrequestStatic: wget theURLGo: none iswritten
Node: fetch the URLPython: urllib requestStatic: wget the URLGo: none is written
Each runtime tests the health URL in its own way.

Before After

Start command, two forms

You typeDockerfile getsnode server.jsnpm start && echo okCMD with a JSON listComment, then plain CMD
You type to Dockerfile getsnode server.jsCMD with a JSON listnpm start && echo okComment, then plain CMD
Plain words use the exec list form. Quotes or shell syntax use shell form.

Before After

Start command resets with the runtime

First twoLast twoNode: node server.jsPython: gunicorn -b0.0.0.0:3000 app:appGo: binary, no start commandStatic: nginx, no startcommand
First two to Last twoNode: node server.jsGo: binary, no start commandPython: gunicorn -b 0.0.0.0:3000app:appStatic: nginx, no start command
Changing the runtime swaps the untouched default start command.

Before After

Secrets stay out of the image

Project fileResult.env in the projectSecrets in that fileListed in .dockerignoreNot copied into the build
Project file to Result.env in the projectListed in .dockerignoreSecrets in that fileNot copied into the build
The .env file is on every ignore list.

Pipeline

Live as you type

Change a fieldRebuild theDockerfileRebuild the.dockerignoreCopy when ready
Change a fieldRebuild the DockerfileRebuild the .dockerignoreCopy when ready
Every field rebuilds both outputs.

Pipeline

Copy the two files

Read theDockerfile boxPress CopyDockerfileRead the.dockerignore boxPress Copy.dockerignore
Read the Dockerfile boxPress Copy DockerfileRead the .dockerignore boxPress Copy .dockerignore
Each output has its own copy button.

Pipeline

Switching the runtime

Pick anotherruntimeCheck the startcommand boxSwap a default forthe new defaultRebuild both files
Pick another runtimeCheck the start command boxSwap a default for the new defaultRebuild both files
The start command box follows when it still holds a default.