Skip to content

Commit b690604

Browse files
committed
chore: update the dockerfile
Signed-off-by: Deep <de6p97@gmail.com>
1 parent 3c1c330 commit b690604

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ RUN npm ci
1717
# Stage 2: Build the application
1818
FROM base AS builder
1919
WORKDIR /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
2028
COPY --from=deps /app/node_modules ./node_modules
2129
COPY . .
2230

@@ -41,16 +49,8 @@ RUN mkdir -p apps/web/.next/cache && \
4149
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
4250
COPY --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

5555
USER nextjs
5656

@@ -59,4 +59,4 @@ ENV PORT=3000
5959
ENV 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

Comments
 (0)