- Added ENV npm_config_ignore_scripts=true to frontend and backend Dockerfiles to skip scripts during npm install, optimizing build times. - Introduced a postinstall script in package.json to ensure the build process for @mmapp/contracts runs after installation.
36 lines
986 B
Docker
36 lines
986 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM node:22-bookworm-slim AS deps
|
|
WORKDIR /app
|
|
ENV npm_config_ignore_scripts=true
|
|
COPY package.json package-lock.json ./
|
|
COPY packages/contracts/package.json packages/contracts/
|
|
RUN npm ci --workspace=@mmapp/contracts --include-workspace-root --ignore-scripts
|
|
|
|
FROM deps AS build
|
|
COPY packages/contracts packages/contracts
|
|
COPY next.config.ts tsconfig.json postcss.config.mjs components.json ./
|
|
COPY app app
|
|
COPY components components
|
|
COPY lib lib
|
|
COPY shared shared
|
|
COPY entities entities
|
|
RUN mkdir -p public
|
|
COPY hooks hooks
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
RUN npm run build -w @mmapp/contracts \
|
|
&& npm run build \
|
|
&& npm prune --omit=dev
|
|
|
|
FROM node:22-bookworm-slim AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV HOSTNAME=0.0.0.0
|
|
ENV PORT=3000
|
|
COPY --from=build /app/public ./public
|
|
COPY --from=build /app/.next/standalone ./
|
|
COPY --from=build /app/.next/static ./.next/static
|
|
EXPOSE 3000
|
|
CMD ["node", "server.js"]
|