Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (45 loc) · 2.57 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (45 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# syntax=docker/dockerfile:1
# Static-only image: the app shell, the prerendered content pages and the
# kernels behind nginx. Cloud features (sharing, sign-in, community, collab)
# have no backend here and answer 503; see docs/self-hosting.md.
# glibc on purpose: it is the toolchain CI and Vercel build with, and the
# native TypeScript compiler has no musl build.
FROM --platform=$BUILDPLATFORM node:26-bookworm-slim@sha256:5df79989ed685e09f0a98019db4cebfb22fb9df1a53c0161664a011f7ff6b0f1 AS build
WORKDIR /app
ENV PNPM_HOME=/pnpm COREPACK_ENABLE_DOWNLOAD_PROMPT=0 CI=true
# corepack reads the pinned pnpm from package.json; it runs before .npmrc lands
# because that file's min-release-age would refuse a fresh exact pin under npm.
# Node 25+ no longer bundles corepack, so it is installed first.
RUN npm install -g corepack@0.36.0 && corepack enable
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
COPY patches ./patches
COPY packages ./packages
# A frozen install needs every workspace manifest the lockfile names.
COPY apps/docs/package.json ./apps/docs/package.json
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --frozen-lockfile --store-dir /pnpm/store
COPY . .
# No .git in the context: version.json and the OCI revision label take these.
ARG GIT_SHA=""
ARG GIT_COMMIT_TIME=""
ARG VERSION="dev"
ARG VITE_SELF_HOSTED=1
ENV GIT_SHA=$GIT_SHA GIT_COMMIT_TIME=$GIT_COMMIT_TIME VITE_SELF_HOSTED=$VITE_SELF_HOSTED
# Hidden source maps are emitted for error-tracking upload; nothing serves them.
RUN pnpm run build && find dist -name '*.map' -delete
# COPY-only stage: nothing executes here, so the arm64 image builds without
# emulation. The dist is arch-independent.
FROM nginxinc/nginx-unprivileged:1.31.7-alpine-slim@sha256:a8cb0f33d51fa107c96fd2bd3a71aaf564ec131e9d2bdf8700944f0ed8b170d7
ARG GIT_SHA=""
ARG VERSION="dev"
LABEL org.opencontainers.image.source="https://github.com/andymai/gridfinity-layout-tool" \
org.opencontainers.image.url="https://gridfinitylayouttool.com" \
org.opencontainers.image.description="Plan Gridfinity drawer layouts and design bins and baseplates for 3D printing" \
org.opencontainers.image.licenses="AGPL-3.0-only" \
org.opencontainers.image.version="$VERSION" \
org.opencontainers.image.revision="$GIT_SHA"
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY docker/self-hosted /usr/share/nginx/self-hosted
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -qO /dev/null http://127.0.0.1:8080/version.json || exit 1