Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 add corepack #2762

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,30 @@ ARG ARG_DYNATRACE_IMAGE='node:16-alpine'
#spa-equinor.kanari.com/e/<environment>/linux/oneagent-codemodules-musl:all
FROM ${ARG_DYNATRACE_IMAGE} AS dynatrace

FROM node:18-alpine AS deps
FROM node:18-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV NODE_OPTIONS="--max_old_space_size=8192"
RUN corepack enable
COPY . /app
WORKDIR /app

# 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
ENV NODE_OPTIONS="--max_old_space_size=8192"

COPY package.json pnpm-lock.yaml ./
COPY web/package.json web/pnpm-lock.yaml web/
COPY web/patches web/patches

RUN \
if [ -f pnpm-lock.yaml ]; then yarn global add [email protected] && pnpm m i --frozen-lockfile;\
if [ -f pnpm-lock.yaml ]; then pnpm m i --frozen-lockfile;\
else echo "Lockfile not found." && exit 1; \
fi

FROM node:18-alpine AS builder
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/web/node_modules ./web/node_modules
Expand All @@ -45,10 +53,10 @@ ENV NEXT_PUBLIC_FRIENDLY_CAPTCHA_PUZZLE_ENDPOINT ${ARG_FRIENDLY_CAPTCHA_PUZZLE_E
# https://nextjs.org/telemetry
ENV NEXT_TELEMETRY_DISABLED 1

RUN cd web && yarn build
RUN pnpm web build

# Production image, copy all the files and run next
FROM node:18-alpine AS runner
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
Expand Down
Loading