Ratan1729/code-execution
1
1FROM node:20-slim2 3# Install compilers and Python directly in container4RUN apt-get update && apt-get install -y --no-install-recommends \5 gcc \6 g++ \7 python3 \8 coreutils \9 && rm -rf /var/lib/apt/lists/*10 11# Create app directory12WORKDIR /app13 14# Copy package files and install dependencies15COPY package*.json ./16RUN npm ci --production17 18# Copy source code19COPY src/ ./src/20COPY .env* ./21 22# Create a non-root user for added security23RUN useradd -m -u 1000 judge && \24 mkdir -p /tmp/judge && \25 chown -R judge:judge /tmp/judge /app26 27# Environment variables for Hugging Face Spaces28ENV NODE_ENV=production29ENV EXECUTION_MODE=process30ENV PORT=786031ENV TEMP_DIR=/tmp/judge32ENV MAX_CONCURRENT=233ENV DEFAULT_TIME_LIMIT=534ENV DEFAULT_MEMORY_LIMIT=25635ENV MAX_TIME_LIMIT=1036ENV MAX_MEMORY_LIMIT=51237ENV MAX_CODE_SIZE=6553638ENV MAX_INPUT_SIZE=524288039ENV RATE_LIMIT_WINDOW=6000040ENV RATE_LIMIT_MAX=3041 42EXPOSE 786043 44# Health check45HEALTHCHECK --interval=30s --timeout=5s --retries=3 \46 CMD wget --no-verbose --tries=1 --spider http://localhost:7860/api/health || exit 147 48# Note: Running as root for now since compilers need access49# In production, consider more restricted permissions50CMD ["node", "src/index.js"]51 