Add Docker support with multi-stage Vite build and nginx serving

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Shayan Azadi
2026-07-01 00:32:25 +03:30
parent ce6c110e06
commit d7252f1d21
5 changed files with 118 additions and 0 deletions

31
Dockerfile Normal file
View File

@@ -0,0 +1,31 @@
# FunZone Accounting Frontend Dockerfile
FROM node:18-alpine AS build
WORKDIR /app
ARG VITE_API_BASE_URL=http://localhost:8001/api
ARG VITE_ACCOUNTING_BASE_URL=http://localhost:8010/api
ARG VITE_BASE_PATH=/
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
ENV VITE_ACCOUNTING_BASE_URL=$VITE_ACCOUNTING_BASE_URL
ENV VITE_BASE_PATH=$VITE_BASE_PATH
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:alpine
RUN apk add --no-cache curl
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost/health || exit 1
CMD ["nginx", "-g", "daemon off;"]