File size: 563 Bytes
0ba4f29 ed2272f 0ba4f29 60b8a84 0ba4f29 60b8a84 0ba4f29 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy all source files
COPY . .
# Install dependencies and build the app
RUN npm install
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Install only production dependencies
COPY package*.json ./
RUN npm install --omit=dev
# Copy compiled files from builder stage
COPY --from=builder /app/dist ./dist
# Hugging Face runs containers with user ID 1000
RUN chown -R 1000:1000 /app
USER 1000
ENV PORT=7860
ENV NODE_ENV=production
EXPOSE 7860
CMD ["node", "dist/server.cjs"]
|