mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-05-12 08:00:11 +02:00
The Dockerfile copied root package.json to /app/version.json, which SystemService.getAppVersion() reads on every render of the app version in the UI. semantic-release only reliably commits that bump back on the main branch; on the rc branch it does not, so v1.31.1-rc.1 and v1.31.1-rc.2 both shipped with a version.json still reading 1.31.0. Result: a user who upgrades to rc.2 sees "1.31.0" in the UI and a persistent "update to v1.31.1-rc.2 available" prompt. The build workflow already passes VERSION as a build-arg (used today only for the OCI image label). Generating version.json from that arg at build time makes the image tag the single source of truth and eliminates the drift, regardless of what the committed-back package.json says. Dev builds (no VERSION override) write "dev", which matches the existing NODE_ENV=development short-circuit in getAppVersion(). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
60 lines
2.1 KiB
Docker
60 lines
2.1 KiB
Docker
FROM node:22-slim AS base
|
|
|
|
# Install bash & curl for entrypoint script compatibility, graphicsmagick for pdf2pic, and vips-dev & build-base for sharp
|
|
RUN apt-get update && apt-get install -y bash curl graphicsmagick libvips-dev build-essential
|
|
|
|
# All deps stage
|
|
FROM base AS deps
|
|
WORKDIR /app
|
|
ADD admin/package.json admin/package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# Production only deps stage
|
|
FROM base AS production-deps
|
|
WORKDIR /app
|
|
ADD admin/package.json admin/package-lock.json ./
|
|
RUN npm ci --omit=dev
|
|
|
|
# Build stage
|
|
FROM base AS build
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules /app/node_modules
|
|
ADD admin/ ./
|
|
RUN node ace build
|
|
|
|
# Production stage
|
|
FROM base
|
|
ARG VERSION=dev
|
|
ARG BUILD_DATE
|
|
ARG VCS_REF
|
|
|
|
# Labels
|
|
LABEL org.opencontainers.image.title="Project N.O.M.A.D" \
|
|
org.opencontainers.image.description="The Project N.O.M.A.D Official Docker image" \
|
|
org.opencontainers.image.version="${VERSION}" \
|
|
org.opencontainers.image.created="${BUILD_DATE}" \
|
|
org.opencontainers.image.revision="${VCS_REF}" \
|
|
org.opencontainers.image.vendor="Crosstalk Solutions, LLC" \
|
|
org.opencontainers.image.documentation="https://github.com/CrosstalkSolutions/project-nomad/blob/main/README.md" \
|
|
org.opencontainers.image.source="https://github.com/CrosstalkSolutions/project-nomad" \
|
|
org.opencontainers.image.licenses="Apache-2.0"
|
|
|
|
ENV NODE_ENV=production
|
|
WORKDIR /app
|
|
COPY --from=production-deps /app/node_modules /app/node_modules
|
|
COPY --from=build /app/build /app
|
|
# Generate version.json from the VERSION build-arg so the image tag is the
|
|
# single source of truth (previously copied root package.json, which drifted
|
|
# from the tag when semantic-release did not commit the bump back).
|
|
RUN echo "{\"version\":\"${VERSION}\"}" > /app/version.json
|
|
|
|
# Copy docs and README for access within the container
|
|
COPY admin/docs /app/docs
|
|
COPY README.md /app/README.md
|
|
|
|
# Copy entrypoint script and ensure it's executable
|
|
COPY install/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] |