Boneyard Tools

Dockerfile Generator

Build a production-ready Dockerfile without memorizing the syntax. Choose your language, version and package manager, toggle multi-stage builds or an Alpine base, then copy the result or download it straight into your project.

How to generate a Dockerfile

  1. Pick your language, base image version and package manager.
  2. Set the port, working directory and any environment variables, then toggle multi-stage or Alpine if you want them.
  3. Copy the output or download the Dockerfile into your project root.

Examples

Node 20 with npm

language: node, version: 20, packageManager: npm, port: 3000
FROM node:20
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node","index.js"]

Go multi-stage build

language: go, version: 1.22, useMultiStage: true
FROM golang:1.22 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /app/app .

FROM alpine:3.20
WORKDIR /app
COPY --from=builder /app/app /app/app
EXPOSE 8080
CMD ["./app"]

Frequently asked questions

What is a Dockerfile?

A Dockerfile is a plain text recipe that tells Docker how to build a container image for your app. Each line is an instruction such as FROM (the base image), COPY (add your files), RUN (run a command at build time) and CMD (the command to run when the container starts).

Where do I put the generated Dockerfile?

Save it as a file named exactly Dockerfile, with no extension, in the root of your project next to your source code. Then run docker build -t myapp . in that folder to build the image.

What is a multi-stage build and when should I use it?

A multi-stage build uses one stage to compile or bundle your app and a second, smaller stage that only contains the finished artifacts. It keeps build tools out of the final image, so it ships smaller and with less attack surface. Use it for compiled languages like Go and Rust, or whenever you have a separate build step.

Why copy the package manifest before the rest of the code?

Docker caches each layer. By copying only package.json (or requirements.txt, go.mod and so on) and installing dependencies before copying your source, the slow install layer is reused on every build where your dependencies have not changed, so rebuilds are much faster.

Should I use the Alpine base image?

Alpine images are much smaller, which speeds up pulls and shrinks your registry footprint. The trade-off is that Alpine uses musl instead of glibc, so some native dependencies need extra build packages. If you hit a compatibility issue, switch back to the standard image.

Is my data sent to a server?

No. The Dockerfile is generated entirely in your browser from the options you choose, so nothing you type is uploaded anywhere.

Related tools