waterwolf-auth/Dockerfile

39 lines
1.1 KiB
Text
Raw Normal View History

2024-11-22 21:25:20 -05:00
FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
2024-11-22 23:17:50 -05:00
FROM base AS base-build
2024-11-22 21:25:20 -05:00
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
2024-11-22 23:17:50 -05:00
FROM base-build AS backend-build
RUN pnpm run build-backend
2024-11-22 21:25:20 -05:00
RUN pnpm deploy --filter=backend --prod /prod/backend
2024-11-22 23:17:50 -05:00
FROM base-build AS frontend-build
RUN pnpm run build-frontend
2024-11-22 21:25:20 -05:00
RUN pnpm deploy --filter=frontend --prod /prod/frontend
2024-11-22 23:17:50 -05:00
FROM node:22-slim AS backend
WORKDIR /app
COPY --from=backend-build /prod/backend/package*.json ./
COPY --from=backend-build /prod/backend/dist ./dist
COPY --from=backend-build /prod/frontend/node_modules ./node_modules
COPY --from=backend-build /usr/src/app/keys ./keys
ENV NODE_ENV=production
2024-11-22 21:25:20 -05:00
EXPOSE 3001
2024-11-22 23:17:50 -05:00
CMD [ "node", "dist/main.js" ]
2024-11-22 21:25:20 -05:00
2024-11-22 23:17:50 -05:00
FROM node:22-slim AS frontend
WORKDIR /app
COPY --from=frontend-build /prod/frontend/package*.json ./
COPY --from=frontend-build /prod/frontend/.next ./.next
COPY --from=frontend-build /prod/frontend/node_modules ./node_modules
ENV NODE_ENV=production
2024-11-22 21:25:20 -05:00
EXPOSE 3000
CMD ["pnpm", "start"]