Prefer IPv4 DNS for npm, cache the npm store between builds, log fetch progress, add retries, and drop the unused ESLint toolchain (291 -> 190 packages). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
822 B
Docker
19 lines
822 B
Docker
# Mega Infrastructure website: build the Vite app, serve the static output with nginx.
|
|
|
|
FROM node:22.14.0-alpine AS build
|
|
WORKDIR /app
|
|
# Servers without working IPv6 can stall npm for minutes per request; prefer IPv4.
|
|
ENV NODE_OPTIONS=--dns-result-order=ipv4first
|
|
COPY app/package.json app/package-lock.json ./
|
|
# Cache mount keeps downloaded packages between deploys; http loglevel shows progress in Coolify.
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
npm ci --no-audit --no-fund --prefer-offline --loglevel=http \
|
|
--fetch-timeout=60000 --fetch-retries=5
|
|
COPY app/ ./
|
|
RUN npm run build
|
|
|
|
FROM nginx:1.27.3-alpine
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
EXPOSE 80
|
|
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1
|