waterwolf-auth/Dockerfile
Trenten Vollmer 3cc8008163
Some checks failed
/ build (push) Failing after 1m19s
fix: dockerfile
2024-11-22 23:17:50 -05:00

40 lines
No EOL
1.1 KiB
Docker

FROM node:22-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
FROM base AS base-build
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
FROM base-build AS backend-build
RUN pnpm run build-backend
RUN pnpm deploy --filter=backend --prod /prod/backend
FROM base-build AS frontend-build
RUN pnpm run build-frontend
RUN pnpm deploy --filter=frontend --prod /prod/frontend
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
EXPOSE 3001
CMD [ "node", "dist/main.js" ]
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/public ./public
COPY --from=frontend-build /prod/frontend/node_modules ./node_modules
ENV NODE_ENV=production
EXPOSE 3000
CMD ["pnpm", "start"]