Executor / Dockerfile
Soumik Bose
go
8775295
Raw
History Blame
1.31 kB
# Use the official Python 3.11 slim image
FROM python:3.11-slim
# Install system dependencies required for Math/Data libraries
# libgomp1 is CRITICAL for scikit-learn & numpy parallelization to prevent segfaults
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
gcc \
g++ \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container
WORKDIR /app
# Create required directories with permissions
RUN mkdir -p /app/generated_outputs /app/generated_charts /app/cache && \
chmod -R 777 /app/generated_outputs /app/generated_charts /app/cache
# Create log files
RUN touch /app/pandasai.log /app/api_key_rotation.log && \
chmod 666 /app/pandasai.log /app/api_key_rotation.log
# Set environment variables
ENV MPLCONFIGDIR=/app/cache
# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Ensure permissions
RUN chown -R 1000:1000 /app && chmod -R 777 /app
# Expose port
EXPOSE 7860
# CMD: Run the python script directly.
# This ensures the 'if __name__ == "__main__":' block in your code actually runs.
CMD bash -c "while true; do curl -s https://code-api-executor.hf.space/ping >/dev/null && sleep 300; done & python controller.py"