full build
This commit is contained in:
33
dockerfile
33
dockerfile
@@ -1,13 +1,34 @@
|
|||||||
# Use the lightweight node
|
FROM node:22-alpine AS build
|
||||||
FROM node:22-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY .output .
|
|
||||||
|
|
||||||
|
#RUN corepack enable
|
||||||
|
|
||||||
|
# Copy package.json
|
||||||
|
COPY package.json .
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN npm i --prod
|
||||||
|
|
||||||
|
# Copy the entire project
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
|
# Build the project
|
||||||
|
RUN npm 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=3000
|
ENV PORT=3000
|
||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
VOLUME [ "/app" ]
|
VOLUME [ "/app" ]
|
||||||
|
|
||||||
CMD ["node","server/index.mjs"]
|
CMD ["node", "/app/server/index.mjs"]
|
||||||
|
|
||||||
Reference in New Issue
Block a user