Strapi Dockerfile generator
Generate a production Dockerfile for Strapi 5 — the admin panel is compiled during the build and dev dependencies are pruned before the runtime image copies the app.
Configure
Loading...
What this Dockerfile does
2 items need attention
Needs attention: Strapi will not boot without its secrets
APP_KEYS, API_TOKEN_SALT, ADMIN_JWT_SECRET, TRANSFER_TOKEN_SALT and JWT_SECRET must all be set at runtime. Pass them with `-e` or through the compose file — never bake them into the image.
Needs attention: Local uploads vanish when the container is replaced
The default upload provider writes to public/uploads inside the container. Mount a volume there, or switch to an S3-compatible provider before you deploy.
Good practice: Multi-stage build (4 stages)
Compilers, dev dependencies and source files stay in the build stages. Only the runtime artefacts are copied into the final image.
Good practice: Runs as node, not root
A container escape from a root process is a host root process. Dropping privileges is the cheapest hardening step there is.
Good practice: .dockerignore keeps secrets out of the build context
`.git`, `.env` and local dependency folders never reach the daemon, so they cannot end up in a layer or in `docker history`.
Good practice: Dependency cache persists across builds
BuildKit cache mounts keep the package manager store outside the image. Rebuilds after a lockfile change reuse everything already downloaded, and the cache adds nothing to the final size.
Good practice: Healthcheck defined
Docker, Compose and Easypanel can tell the difference between a running process and a working app, and restart it when it wedges.
Note: Requires BuildKit
BuildKit is the default builder in Docker 23 and later. On anything older, export `DOCKER_BUILDKIT=1` before building.
Note: Estimated image size: ~130–220 MB
A rough band for the final stage, before your own dependencies. Run `docker images` after a build for the real number.
How to use it
Everything runs locally. Nothing is uploaded, and no account is needed.
Drop the files into your project root
Every generated file belongs next to your package manifest — the Dockerfile references paths relative to the build context, so nesting them in a subfolder breaks the COPY lines.
Build the image
docker build -t strapi .Run it
docker run --rm -p 1337:1337 strapiOr bring up the whole stack
docker compose up --build