CoolFace
Apppublic

DEVessi/devops_sandbox

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
Dockerfile70 linesDownload Raw Back to root
1# Hugging Face Spaces Dockerfile for Self-Healing DevOps Sandbox2FROM ghcr.io/meta-pytorch/openenv-base:latest AS builder3 4USER root5 6# Install Node.js 20 & utilities needed by the sandbox7RUN apt-get update && \8    apt-get install -y --no-install-recommends git curl bash && \9    curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \10    apt-get install -y nodejs && \11    rm -rf /var/lib/apt/lists/*12 13WORKDIR /server_app14 15# Copy environment code16COPY . /server_app/env17WORKDIR /server_app/env18 19# Ensure uv is available20RUN if ! command -v uv >/dev/null 2>&1; then \21        curl -LsSf https://astral.sh/uv/install.sh | sh && \22        mv /root/.local/bin/uv /usr/local/bin/uv && \23        mv /root/.local/bin/uvx /usr/local/bin/uvx; \24    fi25 26# Install dependencies using uv sync27RUN --mount=type=cache,target=/root/.cache/uv \28    if [ -f uv.lock ]; then \29        uv sync --no-install-project --no-editable; \30    else \31        uv sync --no-editable; \32    fi33 34# Final runtime stage35FROM ghcr.io/meta-pytorch/openenv-base:latest36 37USER root38 39# Re-install Node.js 20 in the runtime image40RUN apt-get update && \41    apt-get install -y --no-install-recommends git curl bash psmisc && \42    curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \43    apt-get install -y nodejs && \44    rm -rf /var/lib/apt/lists/*45 46WORKDIR /server_app47 48# Copy the virtual environment from builder49COPY --from=builder /server_app/env/.venv /server_app/.venv50 51# Copy the environment code52COPY --from=builder /server_app/env /server_app/env53 54# Ensure the backup folder for reset() is available and perfectly clean55# The environment script will do `cp -r /app_backup/* /app/` during every reset56RUN mkdir -p /app_backup && \57    cp -r /server_app/env/simulated_app/* /app_backup/ && \58    mkdir -p /app && \59    chmod -R 777 /app /app_backup60 61# Export Paths62ENV PATH="/server_app/.venv/bin:$PATH"63ENV PYTHONPATH="/server_app/env:$PYTHONPATH"64 65# Run the FastAPI server on port 8000 for HuggingFace Spaces66ENV ENABLE_WEB_INTERFACE=true67EXPOSE 800068 69CMD ["sh", "-c", "cd /server_app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000"]70