GLM-4-Voice / Dockerfile
leezhuuu's picture
Update Dockerfile
46a86df verified
raw
history blame
1.77 kB
# # 构建阶段
# 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"