Skip to content

Commit

Permalink
Add .next/cache directory and update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
walnuts1018 committed Jan 19, 2024
1 parent 69dfeda commit 3c6a180
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM node:20-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

RUN mkdir -p .next/cache
COPY .next/cache ./.next/cache

# Install dependencies based on the preferred package manager
Expand All @@ -17,7 +18,7 @@ RUN \
else echo "Lockfile not found." && exit 1; \
fi


# ---------------------------------------------------------------------------------------------------------------
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
Expand All @@ -31,6 +32,7 @@ ENV NEXT_TELEMETRY_DISABLED 1

RUN npm run build

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

0 comments on commit 3c6a180

Please sign in to comment.