Update Dockerfile

This commit is contained in:
2025-09-09 18:20:52 +00:00
parent dc53ccc81d
commit 83fb780733

View File

@@ -1,34 +1,15 @@
# Build Stage 1
FROM node:20-alpine
FROM node:22-alpine AS build
WORKDIR /app
RUN corepack enable
COPY package*.json ./
RUN npm install
# Copy package.json and your lockfile, here we add pnpm-lock.yaml for illustration
COPY package.json pnpm-lock.yaml .npmrc ./
COPY . .
# Install dependencies
RUN pnpm i
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Copy the entire project
COPY . ./
EXPOSE 3000
# Build the project
RUN pnpm run build
# Build Stage 2
FROM node:22-alpine
WORKDIR /app
# Only `.output` folder is needed from the build stage
COPY --from=build /app/.output/ ./
# Change the port and host
ENV PORT=81
ENV HOST=0.0.0.0
EXPOSE 81
CMD ["node", "/app/server/index.mjs"]
CMD ["sh", "/app/entrypoint.sh"]