28 lines
681 B
Docker
28 lines
681 B
Docker
# ============================================
|
|
# PyInstaller 多架构构建镜像
|
|
# ============================================
|
|
FROM python:3.11 AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装构建依赖
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
g++ \
|
|
musl-dev \
|
|
libffi-dev \
|
|
libssl-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 复制整个项目
|
|
COPY . .
|
|
|
|
# 安装 PyInstaller 和项目依赖
|
|
RUN pip install --no-cache-dir pyinstaller -r requirements.txt
|
|
|
|
# 构建可执行文件(使用 .spec 文件生成单文件)
|
|
RUN pyinstaller pyinstaller.spec
|
|
|
|
FROM scratch
|
|
COPY --from=builder /app/dist/hyc-download /
|