Fail the image build when the Nexus token is missing
`docker compose build` without NEXUS_TOKEN produced a Nexus 401 forty seconds in, worded as a credentials problem when it was really an unset variable. The mount's `required=true` asserts the secret was *declared*, not that it holds anything, so an empty one sailed past it and npm sent an empty `_authToken`. The install moves to tools/docker-install-deps.sh, which checks the secret before touching the network and fails in under a second with the three ways to supply it. It is a file rather than inline shell because BuildKit echoes an inline command twice on failure and buries the message. Also ignore .env. It carries NEXUS_TOKEN, compose reads it at build time, and it was not gitignored — .env.example stays tracked. Nothing had been committed: the only prior commit predates all of this. Verified: empty token fails in 0.2s with the message; .env and the environment variable both build; the image carries no trace of the token and serves the full page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,9 @@ tmp
|
||||
.claude
|
||||
docs
|
||||
landing-e2e
|
||||
|
||||
# tools/ IS needed: the build stage copies docker-install-deps.sh from it.
|
||||
# The mock API servers in there are dev-only but too small to be worth excluding.
|
||||
**/*.spec.ts
|
||||
test-output
|
||||
.env
|
||||
|
||||
Reference in New Issue
Block a user