Files
persian-ping-frontend/Dockerfile
soheil khaledabadi a1b03acf04 Fix Docker npm ci by switching build image to Node 20.
Avoid the node:22-alpine crash that fails installs with Exit handler never called.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-02 01:18:05 +03:30

32 lines
1000 B
Docker

# node:22-alpine npm often dies with "Exit handler never called" in Docker builds.
FROM docker.arvancloud.ir/node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY . .
# Vite embeds VITE_* variables in the static bundle during this stage.
ARG VITE_API_URL=https://api.persain-game.com/api/v1
ENV VITE_API_URL=${VITE_API_URL}
RUN npm run build
FROM docker.arvancloud.ir/nginxinc/nginx-unprivileged:1.28-alpine AS runtime
COPY --chown=nginx:nginx nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build --chown=nginx:nginx /app/dist /usr/share/nginx/html
COPY --from=build --chown=nginx:nginx /app/robots.txt /usr/share/nginx/html/robots.txt
COPY --from=build --chown=nginx:nginx /app/sitemap.xml /usr/share/nginx/html/sitemap.xml
USER nginx
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD wget -q -O /dev/null http://127.0.0.1:8080/healthz || exit 1
CMD ["nginx", "-g", "daemon off;"]