Keep secrets out of your image.
A careless COPY . . can bake your .env, .git history, and SSH keys straight into a Docker layer — where anyone who pulls the image can read them. Pick your stack and get a .dockerignore that keeps secrets and bloat out of the build.
The secret you didn’t mean to ship
It happens constantly: a Dockerfile with COPY . ., a .env full of real credentials sitting in the project root, and now that file is a permanent part of an image layer — readable by anyone who can pull it, even after you “delete” it in a later RUN step, because layers keep history. Scanners and researchers find exactly these leaks in public images all the time. A .dockerignore closes the door before it can happen, and it costs you one file.
It’s a small instance of a constant: secrets end up in places you didn’t intend, and the only real defense is keeping them out by default and being able to prove where they are. Managing secrets and build artifacts cleanly across the backend you own is part of what a control plane keeps honest.
Secrets belong in a vault, not a layer.
Infraveil runs your backend on servers you own with secrets managed and access audited — so credentials live in one controlled place, not scattered through images, configs, and chat logs.
See how it worksGet the secure-build playbook
Dockerfiles, secrets, and image hygiene for a backend you run yourself. No spam.