Skip to content
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Stage 1: builder
FROM node:22-alpine AS builder

WORKDIR /app

# install pnpm & git
RUN npm install -g pnpm
RUN apk update && \
apk upgrade && \
apk add --no-cache git

RUN git init


# copy lock, package files and configs
COPY package.json pnpm-lock.yaml ./
COPY run-jiti.js ./
COPY src/features/build-info/script-to-generate-json.ts src/features/build-info/build-info.gen.json ./src/features/build-info/
COPY prisma/schema.prisma ./prisma/
RUN pnpm install --frozen-lockfile

# copy source
COPY . .

# build .output
ENV NODE_OPTIONS=--max-old-space-size=4096
RUN pnpm build


# Stage 2: runtime
FROM node:22-alpine AS runtime


WORKDIR /app

# install pnpm
RUN npm install -g pnpm npm-run-all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is npm-run-all needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run-p not found if I don't install npm run all


COPY .env ./



## copy output build and package.json from builder
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/node_modules ./node_modules

ENV NODE_ENV=production

ENV HOST=0.0.0.0
ENV PORT=3000

EXPOSE 3000

# start
CMD ["pnpm", "start"]
Loading