Merge pull request 'fix(build): stop the version stamp from breaking every Portainer deploy (#235)' (#236) from fix/235-remove-git-copy into main
Reviewed-on: #236
This commit was merged in pull request #236.
This commit is contained in:
+12
-11
@@ -10,18 +10,19 @@ WORKDIR /app/backend
|
|||||||
COPY backend/package.json ./
|
COPY backend/package.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY backend/ ./
|
COPY backend/ ./
|
||||||
# Only this stage ever sees .git, and the final image below copies just `dist`,
|
# There is deliberately no `COPY .git` here. It was tried in #233 and broke
|
||||||
# so no repository history reaches the deployed container. The build reads the
|
# every Portainer deploy with `"/.git": not found` — Portainer's build context
|
||||||
# commit out of it directly rather than shelling out to git, because this base
|
# does not contain the repository history, whatever a local `docker build`
|
||||||
# image has no git binary and adding an apt layer so the image can print seven
|
# suggests. That was the version stamp becoming the thing that stopped a
|
||||||
# characters is a poor trade. See #233.
|
# deploy, which is the one outcome it must never be (#235).
|
||||||
#
|
#
|
||||||
# There is no .dockerignore, so .git is in the build context here and in
|
# The consequence is that `commit` reads "unknown" in any environment Portainer
|
||||||
# Portainer, which clones the repository before building.
|
# builds. `builtAt` is still real, and is the half that matters most here:
|
||||||
COPY .git ./.git
|
# Portainer already reports which commit it cloned, but it cannot tell you
|
||||||
# writeBuildInfo runs against the compiled output, so it has to follow tsc. It
|
# whether the running container is actually that build. A build time can.
|
||||||
# warns rather than fails when .git is unreadable: a deploy must never be
|
#
|
||||||
# stopped by the thing whose only job is to say which deploy it is.
|
# writeBuildInfo runs against the compiled output, so it has to follow tsc, and
|
||||||
|
# it warns rather than fails when it finds no .git.
|
||||||
RUN npm run build && node dist/writeBuildInfo.js
|
RUN npm run build && node dist/writeBuildInfo.js
|
||||||
|
|
||||||
FROM node:20-bookworm-slim
|
FROM node:20-bookworm-slim
|
||||||
|
|||||||
Reference in New Issue
Block a user