Spaces:
Build error
Build error
File size: 1,299 Bytes
93c19dc f091876 93c19dc f091876 93c19dc f091876 | 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # Domify Academy Super Bot - Hugging Face Spaces Dockerfile
# Multi-stage build for optimized production image
# Stage 1: Build stage
FROM node:20-slim AS builder
WORKDIR /app
# Copy package files
COPY package*.json pnpm-lock.yaml* ./
# Install dependencies
RUN npm install -g pnpm && pnpm install --no-frozen-lockfile
# Copy source code
COPY . .
# Build the application
RUN pnpm run build
# Stage 2: Production stage
FROM node:20-slim
WORKDIR /app
# Install production dependencies only
RUN npm install -g pnpm
COPY package*.json pnpm-lock.yaml* ./
RUN pnpm install --prod --no-frozen-lockfile
# Copy built application from builder
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/client/dist ./client/dist
COPY --from=builder /app/drizzle ./drizzle
# Create non-root user for security
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:7860/api/health', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})"
# Set environment variables
ENV NODE_ENV=production
ENV PORT=7860
# Start the application
CMD ["node", "dist/index.js"] |