Download Dockerfile from shegy/b: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/shegy/b/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/shegy/b/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/shegy/b/resolve/main/Dockerfile
1.22 kB
| # 第一阶段:基础设置和代码克隆 | |
| FROM alpine:3.18 AS base | |
| ENV TZ=Asia/Shanghai | |
| # 设置时区并安装 Git | |
| RUN apk add --no-cache git tzdata \ | |
| && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \ | |
| && echo $TZ > /etc/timezone | |
| WORKDIR /zmal | |
| RUN git clone --recursive https://github.com/kmizmal/blivechat.git | |
| # 第二阶段:前端构建 | |
| FROM node:18.17.0-bullseye AS builder | |
| WORKDIR /zmal/blivechat/frontend | |
| # 仅复制需要的文件以提高构建缓存命中率 | |
| COPY --from=base /zmal/blivechat/frontend/package.json package.json | |
| RUN npm install | |
| COPY --from=base /zmal/blivechat/frontend ./ | |
| RUN npm run build | |
| # 第三阶段:后端设置 | |
| FROM python:3.12.7-bookworm | |
| ENV TZ=Asia/Shanghai | |
| WORKDIR /zmal/blivechat | |
| # 拷贝基础代码和构建好的前端 | |
| COPY --from=base /zmal/blivechat ./ | |
| COPY --from=builder /zmal/blivechat/frontend/dist frontend/dist/ | |
| # 安装 Python 依赖 | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| # 设置时区并调整权限 | |
| RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \ | |
| && echo $TZ > /etc/timezone \ | |
| && chmod -R 777 /zmal | |
| # 暴露端口并启动 | |
| EXPOSE 12450 | |
| ENTRYPOINT ["python3", "main.py"] | |
| CMD ["--host", "0.0.0.0", "--port", "12450"] | |