LLM / Dockerfile
Rox-Turbo's picture
Upload 18 files
0b33b65 verified
# Rox AI - Hugging Face Spaces Docker Deployment
# Multi-stage build for smaller image size
FROM node:20-slim AS builder
# Install dependencies only (for caching)
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci --omit=dev 2>/dev/null || npm install --omit=dev && npm cache clean --force
# Production image
FROM node:20-slim
# Container metadata
LABEL maintainer="Rox AI Technologies"
LABEL version="3.9.2"
LABEL description="Rox AI - Production-Ready Professional AI Chat Interface"
# Environment configuration
ENV NODE_ENV=production
ENV PORT=7860
ENV HOST=0.0.0.0
ENV NODE_OPTIONS="--max-old-space-size=512"
# Create non-root user for security
RUN groupadd -r roxai && useradd -r -g roxai -s /bin/false roxai
# Create app directory
WORKDIR /app
# Copy dependencies from builder
COPY --from=builder /app/node_modules ./node_modules
# Copy application files
COPY package.json ./
COPY server.js ./
COPY public ./public
COPY private ./private
# Create uploads directory with proper permissions
RUN mkdir -p uploads && \
chown -R roxai:roxai /app && \
chmod -R 755 /app && \
chmod 700 uploads && \
chmod 700 private
# Switch to non-root user
USER roxai
EXPOSE 7860
# Health check for container orchestration
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD node -e "require('http').get('http://localhost:7860/api/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
CMD ["node", "server.js"]