2026-10-28 20:24:49 +00:00
|
|
|
# Mega Infrastructure website: build the Vite app, serve the static output with nginx.
|
|
|
|
|
|
2026-10-28 21:11:39 +00:00
|
|
|
FROM node:22.14.0-alpine AS build
|
2026-10-28 20:24:49 +00:00
|
|
|
WORKDIR /app
|
2026-10-28 21:11:39 +00:00
|
|
|
# Servers without working IPv6 can stall npm for minutes per request; prefer IPv4.
|
|
|
|
|
ENV NODE_OPTIONS=--dns-result-order=ipv4first
|
2026-10-28 20:24:49 +00:00
|
|
|
COPY app/package.json app/package-lock.json ./
|
2026-10-28 21:11:39 +00:00
|
|
|
# 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
|
2026-10-28 20:24:49 +00:00
|
|
|
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
|