Update Dockerfile
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -1,34 +1,15 @@
|
|||||||
# Build Stage 1
|
FROM node:20-alpine
|
||||||
|
|
||||||
FROM node:22-alpine AS build
|
|
||||||
WORKDIR /app
|
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 . .
|
||||||
COPY package.json pnpm-lock.yaml .npmrc ./
|
|
||||||
|
|
||||||
# Install dependencies
|
COPY entrypoint.sh /app/entrypoint.sh
|
||||||
RUN pnpm i
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
# Copy the entire project
|
EXPOSE 3000
|
||||||
COPY . ./
|
|
||||||
|
|
||||||
# Build the project
|
CMD ["sh", "/app/entrypoint.sh"]
|
||||||
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"]
|
|
||||||
Reference in New Issue
Block a user