2024-10-31 17:59:48 +03:00
|
|
|
FROM node:lts-alpine AS base
|
2023-09-17 01:35:44 +05:30
|
|
|
|
2024-10-31 17:59:48 +03:00
|
|
|
# Stage 1: Install dependencies
|
|
|
|
FROM base AS deps
|
|
|
|
WORKDIR /app
|
2023-12-24 13:59:30 +03:00
|
|
|
COPY package.json pnpm-lock.yaml ./
|
2024-10-31 17:59:48 +03:00
|
|
|
RUN corepack enable pnpm && pnpm install --frozen-lockfile
|
2023-09-17 01:35:44 +05:30
|
|
|
|
2024-10-31 17:59:48 +03:00
|
|
|
# Stage 2: Build the application
|
|
|
|
FROM base AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
COPY . .
|
|
|
|
RUN corepack enable pnpm && pnpm run build
|
2022-04-28 12:15:05 +08:00
|
|
|
|
2024-10-31 17:59:48 +03:00
|
|
|
# Stage 3: Production image
|
|
|
|
FROM nginx:stable AS production
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/out /app
|
|
|
|
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
|
|
|
|
EXPOSE 80
|