34 lines
556 B
Plaintext
34 lines
556 B
Plaintext
# Build Stage 1
|
|
|
|
FROM node:22-alpine AS build
|
|
WORKDIR /src
|
|
|
|
RUN corepack enable
|
|
|
|
# Copy package.json and your lockfile, here we add pnpm-lock.yaml for illustration
|
|
COPY package.json .npmrc ./
|
|
|
|
# Install dependencies
|
|
RUN pnpm i
|
|
|
|
# Copy the entire project
|
|
COPY . ./
|
|
|
|
# Build the project
|
|
RUN pnpm run build
|
|
|
|
# Build Stage 2
|
|
|
|
FROM node:22-alpine
|
|
WORKDIR /src
|
|
|
|
# Only `.output` folder is needed from the build stage
|
|
COPY --from=build /src/.output/ ./
|
|
|
|
# Change the port and host
|
|
ENV PORT=5000
|
|
ENV HOST=0.0.0.0
|
|
|
|
EXPOSE 5000
|
|
|
|
CMD ["node", "/app/server/index.mjs"] |