Skip to content

Fix: exclude .env from Docker image#37

Merged
AquiGorka merged 1 commit intodevfrom
fix/dockerignore-env
Mar 17, 2026
Merged

Fix: exclude .env from Docker image#37
AquiGorka merged 1 commit intodevfrom
fix/dockerignore-env

Conversation

@AquiGorka
Copy link

Summary

  • Adds .env to .dockerignore to prevent local dev config from being baked into Docker images

Context

up.sh generates a .env file with DATABASE_URL=postgresql://...@localhost:5432/.... This file is gitignored but NOT dockerignored, so COPY . . copies it into the image. On Fly, loadEnv.ts reads the .env file before checking Deno.env.get(), so the local DATABASE_URL overrides the Fly secret — causing ECONNREFUSED 127.0.0.1:5432 on every locally-built image.

CI builds are unaffected (clean checkout has no .env), but this prevents deploying from a local machine after running up.sh.

Test plan

  • Built image locally with .env excluded, deployed to Fly — HTTP 200

The local .env file (generated by up.sh) was being copied into the
Docker image via COPY, overriding Fly secrets with localhost:5432
and causing ECONNREFUSED on every deploy built from a local machine.
@AquiGorka AquiGorka merged commit c7818af into dev Mar 17, 2026
2 checks passed
@AquiGorka AquiGorka deleted the fix/dockerignore-env branch March 17, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant