gfds / Dockerfile
Zestysson
Fix: Copy all source files in Dockerfile builder stage
ed2272f
Raw
History Blame Contribute Delete
563 Bytes
# 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"]