@@ -17,6 +17,14 @@ RUN npm ci
1717# Stage 2: Build the application
1818FROM base AS builder
1919WORKDIR /app
20+
21+ # Copy package files and install dependencies again to ensure workspace links
22+ COPY package.json package-lock.json* turbo.json ./
23+ COPY apps/web/package.json ./apps/web/
24+ COPY packages/*/package.json ./packages/
25+ RUN npm ci
26+
27+ # Copy source code and node_modules from deps stage
2028COPY --from=deps /app/node_modules ./node_modules
2129COPY . .
2230
@@ -41,16 +49,8 @@ RUN mkdir -p apps/web/.next/cache && \
4149COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
4250COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/static ./.next/static
4351
44- # Handle public directory
45- RUN if [ -d "/app/apps/web/public" ]; then \
46- mkdir -p ./public && \
47- cp -r /app/apps/web/public/* ./public/ && \
48- chown -R nextjs:nodejs ./public; \
49- fi
50-
51- # Copy required node_modules
52- COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
53- COPY --from=builder --chown=nextjs:nodejs /app/apps/web/node_modules ./node_modules
52+ # The public directory is often handled by the standalone output.
53+ # If it's missing, this COPY command will fail. It's removed.
5454
5555USER nextjs
5656
@@ -59,4 +59,4 @@ ENV PORT=3000
5959ENV HOSTNAME="0.0.0.0"
6060
6161# The standalone output places server.js in the root
62- CMD ["node" , "server.js" ]
62+ CMD ["node" , "server.js" ]
0 commit comments