2026-05-16 17:04:03 +03:30
|
|
|
# syntax=docker/dockerfile:1.4
|
2026-03-30 13:17:34 +03:30
|
|
|
# Build stage for staging environment
|
|
|
|
|
FROM node:20-alpine AS builder
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install pnpm
|
|
|
|
|
RUN npm install -g pnpm
|
|
|
|
|
|
|
|
|
|
# Copy package files
|
|
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
|
|
|
|
|
|
# Install dependencies
|
2026-05-16 17:04:03 +03:30
|
|
|
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \
|
|
|
|
|
pnpm config set store-dir /pnpm/store && pnpm install --frozen-lockfile
|
2026-03-30 13:17:34 +03:30
|
|
|
|
|
|
|
|
# Copy source code
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
|
|
# Build the application for staging
|
|
|
|
|
RUN pnpm run build -- --configuration staging
|
|
|
|
|
|
|
|
|
|
# Production stage - serve with nginx
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
|
|
|
|
# Copy nginx configuration
|
|
|
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
|
|
|
|
|
|
# Copy built application from builder stage
|
|
|
|
|
COPY --from=builder /app/dist/pos.client/browser /usr/share/nginx/html
|
|
|
|
|
|
|
|
|
|
# Expose port
|
2026-04-06 13:31:30 +03:30
|
|
|
EXPOSE 5000
|
2026-03-30 13:17:34 +03:30
|
|
|
|
|
|
|
|
# Health check
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
|
|
|
CMD wget --quiet --tries=1 --spider http://localhost:80/ || exit 1
|
|
|
|
|
|
|
|
|
|
# Start nginx
|
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|