update docker
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-05-29 17:52:09 +03:30
parent 073cc1b169
commit 7d951941ae
4 changed files with 62 additions and 86 deletions
+22 -16
View File
@@ -1,32 +1,38 @@
FROM node:20-alpine AS builder
# syntax=docker/dockerfile:1
# Install tzdata to support timezone settings
RUN apk add --no-cache tzdata
FROM node:22-alpine AS base
ENV TZ=Asia/Tehran
# Set the timezone to Asia/Tehran
RUN cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && echo "Asia/Tehran" > /etc/timezone
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci --ignore-scripts --no-fund --no-audit
WORKDIR /build
COPY package*.json ./
RUN npm install
COPY . ./
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ARG VITE_API_BASE_URL
ARG VITE_TOKEN_NAME
ARG VITE_REFRESH_TOKEN_NAME
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL \
VITE_TOKEN_NAME=$VITE_TOKEN_NAME \
VITE_REFRESH_TOKEN_NAME=$VITE_REFRESH_TOKEN_NAME
VITE_REFRESH_TOKEN_NAME=$VITE_REFRESH_TOKEN_NAME \
NODE_ENV=production
RUN npm run build
FROM nginx:stable-alpine AS production-stage
FROM nginx:stable-alpine AS production
ENV TZ=Asia/Tehran
COPY --from=builder /build/dist /usr/share/nginx/html
COPY --from=builder /build/nginx.con[f] /etc/nginx/conf.d/default.conf
RUN cat /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -q --spider http://127.0.0.1/health || exit 1
CMD ["nginx", "-g", "daemon off;"]