Files
jinshen-website/Dockerfile
R2m1liA 0950e32fe4
All checks were successful
deploy to server / build-and-deploy (push) Successful in 2m59s
fix: 修正Dockerfile
2025-11-05 14:10:10 +08:00

42 lines
763 B
Docker

# -------- Base image --------
FROM node:22-alpine AS base
ENV NODE_ENV=production
WORKDIR /app
# -------- Dependencies layer -------
FROM base AS deps
WORKDIR /app
RUN corepack enable
# Copy package.json and lockfile
COPY package.json pnpm-lock.yaml .npmrc ./
# Install dependencies with cache
RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install
# -------- Build layer -------
FROM deps AS build
# Copy entire project
COPY . ./
ENV NITRO_PRESET=node-server
# Build the project
RUN pnpm run build
# ------- Runtime layer -------
FROM base AS runtime
WORKDIR /app
# COPY .output folder
COPY --from=build /app/.output ./
ENV PORT=3000
ENV NITRO_PRESET=node-server
ENV HOST=0.0.0.0
EXPOSE 3000
CMD ["node", "/app/server/index.mjs"]