Skip to content

Commit

Permalink
fix(Dockerfile): Small changes fixing dev and prod builds
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Jung <alex@unikraft.cloud>
  • Loading branch information
nderjung committed Nov 13, 2024
1 parent a5c3d96 commit 2ac0a5d
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,43 +1,27 @@
FROM node:20-alpine AS base

# Install dependencies only when needed
FROM base AS deps
FROM base AS dev
# 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 /docs

# Install dependencies based on the preferred package manager
COPY package.json package-lock.json* ./

RUN npm install --verbose

# Dev image
FROM base AS dev

ENV NODE_ENV=development
ENV NEXT_TELEMETRY_DISABLED=1

WORKDIR /docs

COPY --from=deps /docs/node_modules ./node_modules

COPY . .

RUN npm run search-meta:gen
RUN npm install

CMD ["npm", "run", "dev"]

# Rebuild the source code only when needed
FROM base AS builder
FROM dev AS builder

WORKDIR /docs

COPY --from=deps /docs/node_modules ./node_modules

COPY . .

ENV NEXT_TELEMETRY_DISABLED 1

RUN set -xe; \
Expand Down

0 comments on commit 2ac0a5d

Please sign in to comment.