添加 Dockerfile
This commit is contained in:
parent
efdb2c98ee
commit
493f5d98e8
|
|
@ -0,0 +1,53 @@
|
|||
FROM registry-vpc.cn-chengdu.aliyuncs.com/zhixueli-prod/python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 设置国内镜像源
|
||||
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
|
||||
sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
|
||||
|
||||
# 安装完整的系统依赖(包含所有 PyGObject 需要的库)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
# 编译工具
|
||||
gcc \
|
||||
g++ \
|
||||
make \
|
||||
pkg-config \
|
||||
cmake \
|
||||
# D-Bus 相关
|
||||
dbus \
|
||||
dbus-x11 \
|
||||
libdbus-1-dev \
|
||||
libdbus-glib-1-dev \
|
||||
# GLib 和 GObject 相关
|
||||
libglib2.0-dev \
|
||||
libgirepository1.0-dev \
|
||||
gobject-introspection \
|
||||
# Cairo 图形库
|
||||
libcairo2-dev \
|
||||
libcairo-gobject2 \
|
||||
# GTK 相关(如果需要)
|
||||
libgtk-3-dev \
|
||||
# 其他常用库
|
||||
libffi-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# 设置 pip 国内镜像源
|
||||
ENV PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ \
|
||||
PIP_TRUSTED_HOST=mirrors.aliyun.com
|
||||
|
||||
# 升级 pip 和构建工具
|
||||
RUN pip install --no-cache-dir --upgrade pip setuptools wheel meson ninja
|
||||
|
||||
# 复制并安装依赖
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 复制项目文件
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8000
|
||||
CMD ["python", "src/main.py", "-m", "http", "-p", "8000"]
|
||||
Loading…
Reference in New Issue