feat: add Dockerfile for backend service
Introduced a multi-stage Dockerfile for the backend, enabling streamlined builds and optimized runtime image with Node.js 22.
This commit is contained in:
17
backend/Dockerfile
Normal file
17
backend/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
FROM node:22-slim AS base
|
||||||
|
ENV PNPM_HOME="/pnpm"
|
||||||
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
RUN corepack enable
|
||||||
|
|
||||||
|
FROM base AS build
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
COPY . .
|
||||||
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||||
|
RUN pnpm run --filter @memegoat/backend build
|
||||||
|
RUN pnpm deploy --filter=@memegoat/backend --prod /app
|
||||||
|
|
||||||
|
FROM base AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app .
|
||||||
|
EXPOSE 3000
|
||||||
|
CMD [ "node", "dist/main" ]
|
||||||
Reference in New Issue
Block a user