Publish Fast Tabler Docker image / build-and-push-fast (push) Failing after 6m35s
47 lines
1.3 KiB
Docker
47 lines
1.3 KiB
Docker
# syntax=docker/dockerfile:1.6
|
|
|
|
# Stage 1: Build React frontend on glibc
|
|
FROM node:20-bookworm-slim AS frontend-builder
|
|
WORKDIR /app/frontend
|
|
|
|
ENV NODE_ENV=development
|
|
RUN npm config set registry https://registry.npmjs.org/ \
|
|
&& npm config set fetch-timeout 300000 \
|
|
&& npm config set fetch-retry-mintimeout 20000 \
|
|
&& npm config set fetch-retry-maxtimeout 120000
|
|
|
|
COPY frontend/package*.json ./
|
|
RUN --mount=type=cache,target=/root/.npm npm install --no-audit --no-fund
|
|
|
|
COPY frontend/src/ ./src/
|
|
COPY frontend/public/ ./public/
|
|
COPY frontend/index.html ./
|
|
COPY frontend/vite.config.js ./
|
|
COPY frontend/eslint.config.js ./
|
|
|
|
ENV ROLLUP_SKIP_NODEJS_NATIVE=1
|
|
ENV ROLLUP_NO_NATIVE=1
|
|
RUN npm run build
|
|
|
|
# Stage 2: Install backend deps on glibc
|
|
FROM node:20-bookworm-slim AS backend-builder
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
RUN npm config set registry https://registry.npmjs.org/ \
|
|
&& npm config set fetch-timeout 300000
|
|
|
|
COPY backend/package*.json ./
|
|
RUN --mount=type=cache,target=/root/.npm npm ci --only=production --no-audit --no-fund
|
|
|
|
# Stage 3: Minimal runtime (distroless)
|
|
FROM gcr.io/distroless/nodejs20-debian12:nonroot
|
|
WORKDIR /app
|
|
|
|
# Copy runtime files
|
|
COPY --from=backend-builder /app/node_modules ./node_modules
|
|
COPY backend/server.js ./server.js
|
|
COPY --from=frontend-builder /app/frontend/dist ./public
|
|
|
|
EXPOSE 3001
|
|
USER nonroot
|
|
CMD ["server.js"] |