From 493f5d98e8a1e8ceb3b90583fc65876270b20453 Mon Sep 17 00:00:00 2001 From: tiananlin Date: Mon, 30 Mar 2026 16:08:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1eaa4dc --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file