Directus Dockerfile generator
Generate a Dockerfile that extends the official Directus image with your own extensions and snapshot, rather than rebuilding Directus from source.
Configure
Loading...
What this Dockerfile does
3 items need attention
Needs attention: No BuildKit cache mounts
Every build with a changed lockfile re-downloads the full dependency tree. Turning cache mounts on is usually the single biggest build-time win.
Needs attention: Uploads need a volume
/directus/uploads is inside the container. Without a mounted volume every uploaded file disappears on the next deploy. The generated compose file mounts one.
Needs attention: Set SECRET, ADMIN_EMAIL and ADMIN_PASSWORD
The compose file uses placeholders so it boots locally. Replace them before this touches a real server.
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: Healthcheck defined
Docker, Compose and Easypanel can tell the difference between a running process and a working app, and restart it when it wedges.
Good practice: Extends the official image
You inherit the upstream security patches and the tested runtime, and your Dockerfile stays three lines long.
Note: Requires BuildKit
BuildKit is the default builder in Docker 23 and later. On anything older, export `DOCKER_BUILDKIT=1` before building.
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 directus .Bring up the stack
docker compose up --build