Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim-bookworm | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| UV_HTTP_TIMEOUT=120 \ | |
| UV_HTTP_MAX_RETRIES=5 \ | |
| HF_HOME=/tmp/hf_cache \ | |
| TRANSFORMERS_CACHE=/tmp/hf_cache | |
| # Create a non-root user | |
| RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser | |
| WORKDIR /app | |
| # Install git + ssh utilities | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| git \ | |
| openssh-client \ | |
| netcat-openbsd \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ | |
| COPY requirements.txt . | |
| RUN uv pip install --system --upgrade pip setuptools wheel | |
| RUN uv pip install --system torch==2.8.0+cpu --index-url https://download.pytorch.org/whl/cpu | |
| RUN uv pip install --system -r requirements.txt | |
| # ========== PRIVATE GIT CLONE BLOCK ========== | |
| ARG GIT_PRIVATE_KEY | |
| # Configure SSH for GitHub | |
| RUN mkdir -p /root/.ssh && \ | |
| printf "%b" "$GIT_PRIVATE_KEY" > /root/.ssh/id_rsa && \ | |
| chmod 600 /root/.ssh/id_rsa && \ | |
| ssh-keyscan github.com >> /root/.ssh/known_hosts | |
| # Clone private repo into a folder | |
| RUN git clone git@github.com:Sisyetad/problemsolution.git /app/CreativeMind && \ | |
| chown -R appuser:appgroup /app/CreativeMind/ProblemSolution && \ | |
| chmod +x /app/CreativeMind/ProblemSolution/entrypoint.sh | |
| # ============================================ | |
| WORKDIR /app/CreativeMind/ProblemSolution | |
| # Switch to non-root user | |
| USER appuser | |
| EXPOSE 7860 | |
| CMD ["sh", "/app/CreativeMind/ProblemSolution/entrypoint.sh"] | |