Files

43 lines
782 B
Docker
Raw Permalink Normal View History

2026-05-04 20:02:10 +03:30
# ---------- Build stage ----------
FROM node:20-alpine AS builder
2026-03-30 13:17:34 +03:30
ARG TENANT=tis
ARG DIST_DIR=tis
2026-03-30 13:17:34 +03:30
WORKDIR /app
RUN npm config set registry "https://hub.megan.ir/npm/"
2026-04-06 13:31:30 +03:30
RUN npm install -g pnpm
2026-05-04 20:02:10 +03:30
2026-03-30 13:17:34 +03:30
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
2026-03-30 13:17:34 +03:30
COPY . .
RUN if [ "$TENANT" = "default" ]; then \
pnpm run build; \
else \
pnpm run build:$TENANT; \
fi
2026-03-30 13:17:34 +03:30
2026-05-04 20:02:10 +03:30
# ---------- Runtime stage ----------
2026-03-30 13:17:34 +03:30
FROM nginx:alpine
2026-05-04 20:02:10 +03:30
# Remove default config
RUN rm -rf /etc/nginx/conf.d/*
2026-05-04 20:02:10 +03:30
# Copy optimized config
COPY nginx.conf /etc/nginx/conf.d/default.conf
ARG DIST_DIR=tis
2026-03-30 13:17:34 +03:30
COPY --from=builder /app/dist/${DIST_DIR}/browser /usr/share/nginx/html
2026-03-30 13:17:34 +03:30
2026-05-04 20:02:10 +03:30
# Optional: reduce image size
# RUN apk add --no-cache brotli
EXPOSE 8090
2026-03-30 13:17:34 +03:30
CMD ["nginx", "-g", "daemon off;"]