Update Dockerfile
Browse files- Dockerfile +5 -4
Dockerfile
CHANGED
|
@@ -1,15 +1,16 @@
|
|
| 1 |
# Install dependencies only when needed
|
| 2 |
-
FROM node:
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# libc6-compat helps some native deps
|
| 6 |
RUN apk add --no-cache libc6-compat
|
| 7 |
|
| 8 |
COPY package.json yarn.lock ./
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
# Rebuild the source code only when needed
|
| 12 |
-
FROM node:
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
COPY --from=deps /app/node_modules ./node_modules
|
|
@@ -17,7 +18,7 @@ COPY . .
|
|
| 17 |
RUN yarn build
|
| 18 |
|
| 19 |
# Production image, copy all the files and run Next.js
|
| 20 |
-
FROM node:
|
| 21 |
WORKDIR /app
|
| 22 |
|
| 23 |
ENV NODE_ENV=production
|
|
|
|
| 1 |
# Install dependencies only when needed
|
| 2 |
+
FROM node:20-alpine AS deps
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
# libc6-compat helps some native deps
|
| 6 |
RUN apk add --no-cache libc6-compat
|
| 7 |
|
| 8 |
COPY package.json yarn.lock ./
|
| 9 |
+
# Remove --frozen-lockfile to allow resolving when the lock is out of sync on HF
|
| 10 |
+
RUN yarn install
|
| 11 |
|
| 12 |
# Rebuild the source code only when needed
|
| 13 |
+
FROM node:20-alpine AS builder
|
| 14 |
WORKDIR /app
|
| 15 |
|
| 16 |
COPY --from=deps /app/node_modules ./node_modules
|
|
|
|
| 18 |
RUN yarn build
|
| 19 |
|
| 20 |
# Production image, copy all the files and run Next.js
|
| 21 |
+
FROM node:20-alpine AS runner
|
| 22 |
WORKDIR /app
|
| 23 |
|
| 24 |
ENV NODE_ENV=production
|