Team Ai
Apppublic

ThomasLe/code-grader-agent

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
Dockerfile62 linesDownload Raw Back to root
1# Use Python 3.11 as base image2FROM python:3.11-slim3 4# Set working directory5WORKDIR /app6 7# Install system dependencies8RUN apt-get update && apt-get install -y \9    git \10    curl \11    build-essential \12    && rm -rf /var/lib/apt/lists/*13 14# Install Node.js 1815RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \16    && apt-get install -y nodejs17 18# Copy backend requirements first for better caching19COPY requirements.txt .20RUN pip install --no-cache-dir -r requirements.txt21 22# Copy frontend package files23COPY FE/package*.json ./FE/24WORKDIR /app/FE25RUN npm install26 27# Copy all source code28WORKDIR /app29COPY . .30 31# Build frontend32WORKDIR /app/FE33RUN npm run build34 35# Set working directory back to app root36WORKDIR /app37 38# Create writable directories for repository cloning39RUN mkdir -p /tmp/repo && chmod 777 /tmp/repo40 41# Create startup script42RUN echo '#!/bin/bash\n\43echo "๐Ÿค– Starting Code-Grader-Agent..."\n\44echo "โœ… Frontend built successfully"\n\45echo "๐Ÿš€ Starting backend server on port 7860..."\n\46python app.py' > start.sh && chmod +x start.sh47 48# Expose port 7860 (required by Hugging Face Spaces)49EXPOSE 786050 51# Set environment variables52ENV PYTHONPATH=/app/BE53ENV NODE_ENV=production54ENV PORT=786055 56# Health check57HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \58  CMD curl -f http://localhost:7860/ || exit 159 60# Run the application61CMD ["./start.sh"]62