gaming-hub/Dockerfile
Daniel bf5b995d7c
All checks were successful
Build & Deploy / build (push) Successful in 1m40s
Build & Deploy / deploy (push) Successful in 6s
Build & Deploy / bump-version (push) Successful in 3s
CI: Enable BuildKit cache mounts for faster npm installs
- Add syntax directive for BuildKit cache-mount support
- Cache /root/.npm between builds (web + server npm install)
- Enable DOCKER_BUILDKIT=1 in CI build step
- Remove aggressive builder prune that killed layer cache after each build

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:50:35 +01:00

36 lines
1.2 KiB
Docker

# syntax=docker/dockerfile:1
FROM node:24-slim AS web-build
WORKDIR /app/web
COPY web/package*.json ./
RUN --mount=type=cache,target=/root/.npm npm install --no-audit --no-fund
COPY web/ .
ARG VITE_BUILD_CHANNEL=stable
ARG VITE_APP_VERSION=dev
ENV VITE_BUILD_CHANNEL=$VITE_BUILD_CHANNEL
ENV VITE_APP_VERSION=$VITE_APP_VERSION
RUN npm run build
FROM node:24-slim AS server-deps
WORKDIR /app/server
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
COPY server/package*.json ./
RUN --mount=type=cache,target=/root/.npm npm install --no-audit --no-fund
FROM server-deps AS server-build
COPY server/ .
RUN npm run build
RUN npm prune --omit=dev
FROM node:24-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production PORT=8080 DATA_DIR=/data
COPY --from=server-build /app/server/dist ./server/dist
COPY --from=server-build /app/server/node_modules ./server/node_modules
COPY --from=server-build /app/server/package.json ./server/package.json
COPY --from=web-build /app/web/dist ./web/dist
COPY tools/install-tools.sh /tmp/install-tools.sh
RUN chmod +x /tmp/install-tools.sh && /tmp/install-tools.sh && rm /tmp/install-tools.sh
EXPOSE 8080
VOLUME ["/data"]
CMD ["node", "server/dist/index.js"]