Refactor multiple modules to improve dependency management by adding missing imports (e.g., `AuthModule`, `CryptoModule`) and ensuring essential services and repositories are exported. Update Dockerfile for better build and runtime efficiency, improve CORS handling, and enhance validation with updates to DTOs. Include package.json refinements for dependency organization.
27 lines
872 B
Docker
27 lines
872 B
Docker
FROM node:22-slim AS base
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
|
|
FROM base AS build
|
|
WORKDIR /usr/src/app
|
|
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
|
COPY backend/package.json ./backend/
|
|
COPY frontend/package.json ./frontend/
|
|
COPY documentation/package.json ./documentation/
|
|
RUN pnpm install --no-frozen-lockfile
|
|
COPY . .
|
|
# On réinstalle après COPY pour s'assurer que tous les scripts de cycle de vie et les liens sont corrects
|
|
RUN pnpm install --no-frozen-lockfile
|
|
RUN pnpm run --filter @memegoat/backend build
|
|
RUN pnpm deploy --filter=@memegoat/backend --prod --legacy /app
|
|
RUN cp -r backend/dist /app/dist
|
|
RUN cp -r backend/.migrations /app/.migrations
|
|
|
|
FROM base AS runtime
|
|
WORKDIR /app
|
|
COPY --from=build /app .
|
|
EXPOSE 3000
|
|
ENV NODE_ENV=production
|
|
CMD [ "node", "dist/src/main" ]
|