Skip to content

Commit e78589c

Browse files
committed
update: dockerfile for production
1 parent c42373a commit e78589c

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

Dockerfile.prod

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
FROM node:20-alpine AS base
22

3-
# Stage 1: Install dependencies only when needed
43
FROM base AS deps
5-
RUN apk add --no-cache libc6-compat
6-
74
RUN set -ex; \
85
apk update; \
96
apk add --no-cache \
7+
libc6-compat \
108
openssl
119

1210
WORKDIR /usr/src/app
@@ -17,30 +15,25 @@ COPY packages/ ./packages/
1715

1816
RUN yarn install --ignore-scripts
1917

20-
# Stage 2: Rebuild the source code only when needed
2118
FROM base AS builder
2219
WORKDIR /usr/src/app
2320

2421
COPY --from=deps /usr/src/app/node_modules ./node_modules
25-
2622
COPY . .
2723

2824
RUN yarn global add turbo@^2.1.1
29-
30-
RUN DATABASE_URL=$DATABASE_URL npx prisma generate --schema packages/db/prisma/schema.prisma
25+
RUN DATABASE_URL=$DATABASE_URL npx [email protected] generate --schema packages/db/prisma/schema.prisma
3126

3227
RUN cd apps/web && yarn add sharp
3328
RUN yarn turbo run build --filter=web...
3429

35-
# Stage 3: Production image
3630
FROM base AS runner
3731
WORKDIR /usr/src/app
3832

3933
RUN addgroup --system --gid 1001 nodejs
4034
RUN adduser --system --uid 1001 nextjs
4135

42-
RUN mkdir .next
43-
RUN chown nextjs:nodejs .next
36+
RUN mkdir .next && chown nextjs:nodejs .next
4437

4538
USER nextjs
4639

@@ -50,7 +43,6 @@ COPY --from=builder --chown=nextjs:nodejs /usr/src/app/apps/web/public ./apps/we
5043

5144
EXPOSE 3000
5245
ENV NODE_ENV production
53-
# For Standalone build
5446
ENV PORT 3000
5547
ENV HOSTNAME "0.0.0.0"
5648

0 commit comments

Comments
 (0)