Spaces:
Sleeping
Sleeping
| # Base Python image | |
| FROM python:3.11-slim | |
| # Install system dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y \ | |
| opam m4 unzip librsvg2-bin curl bubblewrap make gcc \ | |
| git ca-certificates sudo tar gzip pkg-config libcairo2-dev && \ | |
| apt-get clean | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| WORKDIR /home/user | |
| # Set environment variables | |
| ENV HOME=/home/user \ | |
| OPAMYES=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PATH=/home/user/.opam/5.2.1/bin:$PATH \ | |
| GRADIO_ALLOW_FLAGGING=never \ | |
| GRADIO_NUM_PORTS=1 \ | |
| GRADIO_SERVER_NAME=0.0.0.0 \ | |
| GRADIO_THEME=huggingface \ | |
| SYSTEM=spaces | |
| SHELL ["/bin/bash", "-c"] | |
| # Initialize OPAM, create switch, add grew remote, install grewpy_backend | |
| RUN opam init -y --disable-sandboxing && \ | |
| opam switch create 5.2.1 -y && \ | |
| eval $(opam env) && \ | |
| opam remote add grew https://opam.grew.fr --all-switches || true && \ | |
| opam update && \ | |
| opam install -y dune grewpy_backend | |
| # Set working directory for app | |
| WORKDIR /home/user/app | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| RUN pip install grewpy black ruff pytest | |
| # Copy the application code | |
| COPY --chown=user . . | |
| # Run the app | |
| CMD ["python", "app.py"] |