mirror of
https://github.com/temetro/temetro.git
synced 2026-07-26 11:58:14 +00:00
a3f4cf8633
The frontend dependency install (1000+ packages) failed in Docker with ECONNRESET / "network aborted" mid-stream. Add npm fetch retries and a long timeout so a transient registry drop is retried rather than failing the build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
1.1 KiB
Docker
34 lines
1.1 KiB
Docker
# --- deps ------------------------------------------------------------------
|
|
FROM node:22-alpine AS deps
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
# Retry on transient registry drops (ECONNRESET / "network aborted") and allow a
|
|
# long timeout — the dependency set is large, so a slow connection can stall.
|
|
RUN npm ci --no-audit --no-fund \
|
|
--fetch-retries=5 \
|
|
--fetch-retry-mintimeout=20000 \
|
|
--fetch-retry-maxtimeout=180000 \
|
|
--fetch-timeout=900000
|
|
|
|
# --- build (Next.js standalone output) -------------------------------------
|
|
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
# NEXT_PUBLIC_* values are inlined at build time.
|
|
ARG NEXT_PUBLIC_API_URL=http://localhost:4000
|
|
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# --- runtime ---------------------------------------------------------------
|
|
FROM node:22-alpine AS runtime
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOSTNAME=0.0.0.0
|
|
COPY --from=build /app/public ./public
|
|
COPY --from=build /app/.next/standalone ./
|
|
COPY --from=build /app/.next/static ./.next/static
|
|
EXPOSE 3000
|
|
CMD ["node", "server.js"]
|