feat: inject git SHA + build timestamp into version.json during docker build
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -7,6 +7,15 @@ RUN cd client && npm install
|
|||||||
COPY client/ ./client/
|
COPY client/ ./client/
|
||||||
RUN cd client && npm run build
|
RUN cd client && npm run build
|
||||||
|
|
||||||
|
# ── Version metadata ──────────────────────────────────────────────────────────
|
||||||
|
# Pass these at build time:
|
||||||
|
# docker build --build-arg GIT_SHA=$(git rev-parse HEAD) \
|
||||||
|
# --build-arg BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ) .
|
||||||
|
ARG GIT_SHA=dev
|
||||||
|
ARG BUILD_TIME=unknown
|
||||||
|
RUN echo "{\"sha\":\"${GIT_SHA}\",\"shortSha\":\"${GIT_SHA:0:7}\",\"buildTime\":\"${BUILD_TIME}\"}" \
|
||||||
|
> /build/client/dist/version.json
|
||||||
|
|
||||||
FROM node:20-alpine AS production
|
FROM node:20-alpine AS production
|
||||||
RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont
|
RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont
|
||||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||||
@@ -25,5 +34,6 @@ COPY demo/ ./demo/
|
|||||||
COPY client/public/static ./client/dist/static
|
COPY client/public/static ./client/dist/static
|
||||||
RUN mkdir -p /data
|
RUN mkdir -p /data
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 CMD wget -qO- http://localhost:3001/api/health || exit 1
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
|
CMD wget -qO- http://localhost:3001/api/health || exit 1
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
|
|||||||
Reference in New Issue
Block a user