webder/Dockerfile

27 lines
655 B
Text
Raw Normal View History

2024-05-16 16:44:49 +03:00
FROM node:20-alpine as base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
2024-03-21 14:47:07 +03:00
WORKDIR /app
2024-05-16 16:44:49 +03:00
FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build
FROM node:20-alpine as run
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
2024-03-21 14:47:07 +03:00
WORKDIR /app
2024-05-16 16:44:49 +03:00
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist/
COPY --from=build /app/package.json /app/package.json
2024-03-21 14:47:07 +03:00
EXPOSE 8080
2024-05-16 16:44:49 +03:00
CMD [ "pnpm", "start" ]