-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 819 Bytes
/
Copy pathDockerfile
File metadata and controls
38 lines (26 loc) · 819 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
# Build Stage 1
FROM node:26-alpine AS build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /app
# Node.js 26 no longer ships corepack, so install it first
RUN npm install -g corepack@0.35.0 && corepack enable
# Copy package.json and your lockfile, here we add pnpm-lock.yaml for illustration
COPY package.json pnpm-*.yaml ./
# Install dependencies
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
# Copy the entire project
COPY . ./
# Build the project
ENV NITRO_PRESET=node-server
RUN pnpm run build
# Build Stage 2
FROM node:26-alpine AS prod
WORKDIR /app
# Only `.output` folder is needed from the build stage
COPY --from=build /app/.output/ ./
# Change the port and host
ENV PORT=8080
ENV HOST=0.0.0.0
EXPOSE 8080
CMD ["node", "/app/server/index.mjs"]