Spaces:
Sleeping
Sleeping
# First stage: generate the package-lock.json file | |
FROM node:21 as builder | |
WORKDIR /app | |
# Copy package.json to generate package-lock.json | |
COPY package.json ./ | |
# Run npm install to generate package-lock.json | |
RUN npm install | |
# Second stage: use the generated package-lock.json for a clean install | |
FROM node:21 | |
WORKDIR /app | |
# Copy package.json and the generated package-lock.json from the builder stage | |
COPY package.json ./ | |
COPY --from=builder /app/package-lock.json ./ | |
# Use npm ci with the lock file for a reproducible, production install | |
RUN npm ci --only=production | |
# Copy the rest of your application code | |
COPY . . | |
EXPOSE 7860 | |
CMD ["node", "server.js"] |