File size: 1,737 Bytes
fefc401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fbdb003
 
01e21f9
 
fefc401
 
a6ea6ae
06df12e
 
a6ea6ae
46a86df
01e21f9
 
 
a6ea6ae
01e21f9
a6ea6ae
fbdb003
a6ea6ae
01e21f9
fbdb003
a6ea6ae
01e21f9
fefc401
 
01e21f9
fbdb003
06df12e
46a86df
fefc401
01e21f9
 
fefc401
 
 
bbfdcdb
 
1ea38f1
46a86df
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# # 构建阶段
# FROM python:3.11 as builder

# WORKDIR /app
# COPY . /app

# RUN python -m venv .venv
# ENV PATH="/app/.venv/bin:$PATH"
# RUN pip install --upgrade pip
# RUN pip install --no-cache-dir -r requirements.txt
# RUN apt-get update && apt-get install -y git-lfs
# RUN git lfs install
# RUN git clone https://huggingface.co/THUDM/glm-4-Voice-decoder

# # 运行阶段
# FROM python:3.11-slim

# WORKDIR /app
# COPY --from=builder /app/.venv /app/.venv
# COPY --from=builder /app/glm-4-Voice-decoder /app/glm-4-Voice-decoder
# COPY --from=builder /app/web_demo.py /app/

# ENV PATH="/app/.venv/bin:$PATH"
# EXPOSE 8888
# EXPOSE 8000

# CMD sh -c "nohup .venv/bin/python model_server.py & .venv/bin/python web_demo.py"

# 构建阶段
FROM python:3.11 as builder

WORKDIR /app

# 复制所有文件,然后显式复制 model_server.py 和 web_demo.py
COPY . /app
COPY ./model_server.py /app/
COPY ./web_demo.py /app/


RUN python -m venv .venv
ENV PATH="/app/.venv/bin:$PATH"
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN apt-get update && apt-get install -y git-lfs
RUN git lfs install
RUN git clone https://huggingface.co/THUDM/glm-4-Voice-decoder

# 运行阶段
FROM python:3.11-slim

WORKDIR /app

# 从构建阶段复制必要的文件和目录
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app/glm-4-Voice-decoder /app/glm-4-Voice-decoder
COPY --from=builder /app/model_server.py /app/
COPY --from=builder /app/web_demo.py /app/


ENV PATH="/app/.venv/bin:$PATH"
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
RUN mkdir -p /app/.cache/huggingface/hub

EXPOSE 8888
EXPOSE 8000

CMD sh -c "nohup .venv/bin/python model_server.py & .venv/bin/python web_demo.py"