File size: 991 Bytes
15a9825
ad71704
 
 
 
 
 
 
 
 
15a9825
ad71704
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# GPU-ready Docker image for the Qwen2.5 Text-to-SQL LoRA Gradio app

FROM python:3.11-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    curl \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Hugging Face Docker Spaces run containers as UID 1000
RUN useradd -m -u 1000 user

USER user

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    HF_HOME=/home/user/.cache/huggingface \
    GRADIO_SERVER_NAME=0.0.0.0 \
    GRADIO_SERVER_PORT=7860 \
    PORT=7860

WORKDIR $HOME/app

COPY --chown=user:user requirements.txt ./requirements.txt

# match the successful local (CUDA-enabled) PyTorch training environment
RUN python -m pip install --upgrade pip && \
    python -m pip install torch==2.11.0 \
        --index-url https://download.pytorch.org/whl/cu128 && \
    python -m pip install -r requirements.txt

COPY --chown=user:user . $HOME/app

EXPOSE 7860

CMD ["python", "app.py"]