← back to flaviocopes.com

Dockerfile generator

← All tools

Pick a stack and options — get a commented Dockerfile, matching .dockerignore, and docker build/run commands you can paste into your project.

~~~

Stack preset

~~~

Options

~~~

Output

Templates use current best practices: slim/alpine bases, copy lockfiles before source for layer caching, and npm ci (or equivalent) for reproducible installs. Adjust paths and start commands to match your project layout.

~~~

About this tool

A Dockerfile is the recipe Docker uses to build an image. Getting the layer order right — dependencies before source code — means rebuilds stay fast when you change application files but not package manifests.

Multi-stage builds compile in one stage and copy only what production needs into the final image. That keeps devDependencies, build caches, and source maps out of what you deploy.

Next.js standalone output bundles the server and dependencies into.next/standalone — the template assumes you setoutput: 'standalone' in next.config. Astro SSR expects the Node adapter and a dist/server/entry.mjs entry point after npm run build.

~~~

Read more