Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
fix: copy .yarnrc.yml on deps build
Browse files Browse the repository at this point in the history
  • Loading branch information
radioegor146 committed Sep 6, 2024
1 parent 21f4eb7 commit c77a0f1
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions node.prod.dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
FROM node:18-alpine AS base

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock ./
COPY package.json yarn.lock .yarnrc.yml ./
RUN corepack enable && yarn set version stable
RUN yarn --immutable

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
Expand All @@ -30,23 +27,17 @@ ENV NEXT_PUBLIC_SWYNCA_CURRENCY ${NEXT_PUBLIC_SWYNCA_CURRENCY}
RUN yarn prisma generate
RUN yarn build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

USER nextjs

# COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static

Expand Down

0 comments on commit c77a0f1

Please sign in to comment.