-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (31 loc) · 963 Bytes
/
Dockerfile
File metadata and controls
47 lines (31 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM node:22-alpine AS base
# https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine
RUN apk update && \
apk add --no-cache libc6-compat
WORKDIR /app
# --- Build Stage ---
FROM base AS build
# Setup the environment for pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
# Copy the package.json to install the correct version of pnpm
COPY package.json ./
RUN corepack enable && \
corepack install
# Copy lockfile and workspace config
COPY pnpm-workspace.yaml ./
COPY pnpm-lock.yaml ./
# Install dependencies with cache
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
# Copy the rest of the application code
COPY . .
RUN pnpm build
# --- Runner Stage ---
FROM base AS runner
ENV NODE_ENV=production
USER node
# Copy build output
COPY --from=build --chown=node:node /app/.output .
EXPOSE 3000
CMD ["node", "./server/index.mjs"]