edit build
This commit is contained in:
parent
d877d0fae2
commit
e295c13ba3
2 changed files with 42 additions and 26 deletions
|
|
@ -1,30 +1,25 @@
|
|||
# Base stage
|
||||
FROM node:lts-alpine AS base
|
||||
FROM node:20-slim AS base
|
||||
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
# Dependencies stage
|
||||
FROM base AS deps
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||
|
||||
# Build stage
|
||||
FROM base AS build
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
RUN pnpm run build
|
||||
|
||||
# Production stage
|
||||
FROM node:lts-alpine AS prod
|
||||
FROM base as prod
|
||||
ENV NODE_ENV="production"
|
||||
WORKDIR /app
|
||||
|
||||
# Copy necessary files from previous stages
|
||||
COPY --from=deps /app/node_modules /app/node_modules
|
||||
COPY --from=build /app/dist /app/dist
|
||||
COPY --from=base /app/static /app/static
|
||||
|
||||
# Start the application
|
||||
CMD ["pnpm", "run", "start"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue