dongsiqie commited on
Commit
a1dfa66
·
verified ·
1 Parent(s): 5719f9b

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -0
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用Python 3.11作为基础镜像
2
+ FROM python:3.11-slim
3
+
4
+ # 设置工作目录
5
+ WORKDIR /app
6
+
7
+ # 设置环境变量
8
+ ENV PYTHONDONTWRITEBYTECODE=1 \
9
+ PYTHONUNBUFFERED=1
10
+
11
+ # 安装系统依赖
12
+ RUN apt-get update \
13
+ && apt-get install -y --no-install-recommends \
14
+ build-essential \
15
+ git \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # 克隆代码仓库
19
+ RUN git clone https://github.com/yangjianchuan/PySQLAPI /app
20
+
21
+ # 安装Python依赖
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # 暴露端口
25
+ EXPOSE 8000
26
+
27
+ # 启动命令
28
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]