tetel commited on
Commit
e044575
·
verified ·
1 Parent(s): 5c5a840

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -5
Dockerfile CHANGED
@@ -1,16 +1,33 @@
 
1
  FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
2
 
 
3
  WORKDIR /app
4
 
5
- # Install dependencies
 
 
 
 
 
 
 
 
 
 
 
6
  COPY pyproject.toml .
7
  RUN uv sync
8
 
9
- # Copy application code
10
- COPY main.py .
 
 
11
 
12
- # Expose the port the app runs on
13
  EXPOSE 8000
14
 
15
- # Command to run the application
 
 
16
  CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # 使用 Python 3.12 slim-bookworm 镜像作为基础
2
  FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
3
 
4
+ # 设置工作目录
5
  WORKDIR /app
6
 
7
+ # 安装 Git
8
+ RUN apt-get update && apt-get install -y git
9
+
10
+ # 从 GitHub 克隆 Gemi2Api-Server 仓库
11
+ # 注意:这里我们克隆到工作目录 /app
12
+ RUN git clone https://github.com/zhiyu1998/Gemi2Api-Server.git .
13
+ # 或者,如果您希望将代码克隆到一个名为 Gemi2Api-Server 的子目录中,然后将工作目录更改为该子目录:
14
+ # RUN git clone https://github.com/zhiyu1998/Gemi2Api-Server.git Gemi2Api-Server
15
+ # WORKDIR /app/Gemi2Api-Server
16
+
17
+ # 安装依赖
18
+ # 假设 pyproject.toml 文件位于仓库的根目录
19
  COPY pyproject.toml .
20
  RUN uv sync
21
 
22
+ # 复制应用程序代码 (如果 git clone 已经复制了所有代码,这一步可能不再需要,
23
+ # 或者需要调整路径,取决于您的项目结构和上面的 git clone 方式)
24
+ # 如果 pyproject.toml 和 main.py 都在仓库根目录,则 git clone 之后它们就已经在 /app 下了
25
+ # COPY main.py . # 如果 main.py 在仓库根目录,则此行可以省略或调整
26
 
27
+ # 暴露应用程序运行的端口
28
  EXPOSE 8000
29
 
30
+ # 运行应用程序的命令
31
+ # 确保 main:app 的路径相对于 uv run 的执行目录是正确的
32
+ # 如果 main.py 在 /app (克隆后的根目录),则命令应该可以正常工作
33
  CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]