# Better use newer Python as generated code can use new features FROM python:3.10-slim # RUN rm -rf /var/lib/apt/lists/* # install git, g++ and python3-tk RUN apt-get update && apt-get install -y git g++ python3-tk zip unzip procps r-base # upgrade to latest pip RUN pip install --upgrade pip RUN pip install fastapi gunicorn uvicorn[standard] httpx pydantic==2.* plotly # Acquire benchmark code to local # ADD "https://api.github.com/repos/bigcode-project/bigcodebench/commits?per_page=1" latest_commit # RUN git clone https://github.com/bigcode-project/bigcodebench.git /bigcodebench # RUN cd /bigcodebench # RUN python3 -c "from bigcodebench.data import get_bigcodebench; get_bigcodebench()" # Add a new user "bigcodebenchuser" RUN adduser --disabled-password --gecos "" bigcodebenchuser RUN pip install -I --timeout 2000 -r https://github.com/bigcode-project/bigcodebench-annotation/releases/download/v0.1.0/requirements.txt RUN python -m nltk.downloader punkt COPY . . WORKDIR / # For matplotlib import caching in reliability guard RUN mkdir -p /api/cache/matplotlib ENV MPLCONFIGDIR=/api/cache/matplotlib RUN chmod -R 777 /api RUN chown -R bigcodebenchuser:bigcodebenchuser /api USER bigcodebenchuser # Start the FastAPI app on port 7860, the default port expected by Spaces # CMD ["uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "7860"] # ENTRYPOINT [ "./dev.sh" ] ENTRYPOINT [ "./prod.sh" ]