Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -13
Dockerfile
CHANGED
|
@@ -1,27 +1,25 @@
|
|
| 1 |
-
#
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN apt-get update && apt-get install -y git
|
| 9 |
|
| 10 |
-
#
|
| 11 |
ENV MPLCONFIGDIR=/tmp/.matplotlib
|
| 12 |
-
|
| 13 |
-
# Create Matplotlib configuration directory
|
| 14 |
RUN mkdir -p /tmp/.matplotlib && chmod -R 777 /tmp/.matplotlib
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
RUN --mount=type=secret,id=GITHUB_TOKEN
|
| 18 |
git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@github.com/leoncool23/sci_xg_classify.git .
|
| 19 |
|
| 20 |
-
#
|
| 21 |
RUN pip install -r requirements.txt
|
| 22 |
|
| 23 |
-
#
|
| 24 |
EXPOSE 8051
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
CMD ["streamlit", "run", "app.py", "--server.port=8051", "--server.address=0.0.0.0", "--server.enableCORS=false"
|
|
|
|
| 1 |
+
# 使用轻量级 Python 镜像
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# 设置工作目录
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# 安装必要依赖
|
| 8 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# 设置 Matplotlib 配置目录
|
| 11 |
ENV MPLCONFIGDIR=/tmp/.matplotlib
|
|
|
|
|
|
|
| 12 |
RUN mkdir -p /tmp/.matplotlib && chmod -R 777 /tmp/.matplotlib
|
| 13 |
|
| 14 |
+
# 克隆私有仓库(使用密钥访问)
|
| 15 |
+
RUN --mount=type=secret,id=GITHUB_TOKEN \
|
| 16 |
git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@github.com/leoncool23/sci_xg_classify.git .
|
| 17 |
|
| 18 |
+
# 安装 Python 依赖
|
| 19 |
RUN pip install -r requirements.txt
|
| 20 |
|
| 21 |
+
# 暴露 Streamlit 端口
|
| 22 |
EXPOSE 8051
|
| 23 |
|
| 24 |
+
# 启动 Streamlit
|
| 25 |
+
CMD ["streamlit", "run", "app.py", "--server.port=8051", "--server.address=0.0.0.0", "--server.enableCORS=false"]
|