File size: 1,791 Bytes
5ef407f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FROM python:3.10-slim


# (0) Install SSH client tools (and git, if you're pulling via SSH)
RUN apt-get update && \
    apt-get install -y --no-install-recommends openssh-client git && \
    rm -rf /var/lib/apt/lists/*

# The two following lines are requirements for the Dev Mode to be functional
# Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers
RUN useradd -m -u 1000 user
WORKDIR /app


# (2) Copy dependencies manifest
COPY --chown=user requirements.txt requirements.txt

# (3) Install dependencies, mounting SSH keys and optional HTTPS creds
RUN --mount=type=secret,id=AGENTEVAL_DEPLOY_KEY,mode=0400,required=true \
    --mount=type=secret,id=ASTABENCH_DEPLOY_KEY,mode=0400,required=true \
    mkdir -p /root/.ssh && chmod 700 /root/.ssh && \
    cat /run/secrets/AGENTEVAL_DEPLOY_KEY > /root/.ssh/id_ed25519 && chmod 600 /root/.ssh/id_ed25519 && \
    cat /run/secrets/ASTABENCH_DEPLOY_KEY > /root/.ssh/id_astabench && chmod 600 /root/.ssh/id_astabench && \
    ssh-keyscan github.com >> /root/.ssh/known_hosts && \
    printf 'Host github.com\n  User git\n  IdentityFile /root/.ssh/id_ed25519\n  IdentityFile /root/.ssh/id_astabench\n  StrictHostKeyChecking no\n' >> /root/.ssh/config && \
    # rewrite all GitHub HTTPS URLs to SSH so nested deps install via SSH
    git config --global url."ssh://[email protected]/".insteadOf "https://github.com/" && \
    pip install --no-cache-dir --upgrade -r requirements.txt

# (4) Copy in your Gradio app code
COPY . .
RUN mkdir -p /home/user/data && chown -R user:user /home/user/data

# Make the app treat this as non‑debug (so DATA_DIR=/home/user/data)
ENV system=spaces

# (5) Switch to a non-root user
USER user

# (6) Expose Gradio’s default port
EXPOSE 7860

# (7) Launch your app
CMD ["python", "app.py"]