File size: 781 Bytes
b715625
 
58035e6
 
 
b715625
 
 
e85944d
 
 
 
58035e6
b715625
 
 
 
 
 
 
 
 
 
 
 
 
d86ae16
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
FROM nvcr.io/nvidia/pytorch:25.09-py3 AS base

RUN apt-get update && \
    apt-get install -y git-lfs

COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

RUN git clone https://github.com/xueh-nv/aiconfigurator.git && \
    cd aiconfigurator && \
    git lfs pull && \
    pip3 install .[webapp]

# 创建与 HF Spaces 运行时一致的 uid=1000 用户,避免 getpwuid() 错误
RUN groupadd -g 1000 user && \
    useradd -m -u 1000 -g user user || true

# 复制代码至工作目录
WORKDIR $HOME/app
COPY --chown=user . $HOME/app

# HF Spaces 默认通过 $PORT 注入端口
ENV PORT=7860
EXPOSE 7860

# 启动 FastAPI 服务
CMD ["aiconfigurator", "webapp", "--server_name", "0.0.0.0", "--server_port", "7860"]