Spaces:
Sleeping
Sleeping
Download Dockerfile from cormort/PDF_RGB2CMYK: direct link, hf CLI and curl.
- Browser
- Download file 1.75 kB
-
https://huggingface.co/spaces/cormort/PDF_RGB2CMYK/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/cormort/PDF_RGB2CMYK/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/cormort/PDF_RGB2CMYK/resolve/main/Dockerfile
1.75 kB
| FROM python:3.10-slim | |
| # 系統依賴必須與 packages.txt 一致,否則預檢會缺工具、DOCX 會缺字型而大量跑版。 | |
| # ghostscript CMYK 轉換與總墨量預檢 | |
| # libreoffice-writer DOCX → 中介 PDF | |
| # poppler-utils pdfimages / pdffonts / pdfinfo 預檢 | |
| # fontconfig + 字型 fc-list / fc-match 與中文字型替代 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ghostscript \ | |
| libreoffice-writer \ | |
| poppler-utils \ | |
| fontconfig \ | |
| fonts-noto-cjk \ | |
| fonts-liberation \ | |
| fonts-dejavu-core \ | |
| fonts-crosextra-carlito \ | |
| fonts-crosextra-caladea \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 建置時就確認外部工具存在,避免上線後才發現預檢功能靜默失效 | |
| RUN gs --version \ | |
| && soffice --version \ | |
| && pdfimages -v \ | |
| && fc-list --version | |
| WORKDIR /app | |
| # 只需要應用程式檔案;ICC Profile 就在專案根目錄,而 app.py 以自身所在目錄 | |
| # 尋找它們(BASE_DIR),因此不需要複製到 /usr/share/color/icc。 | |
| # README 的 sdk_version 是 Space 自動安裝的版本,這裡明確釘住相同版本, | |
| # 讓 Docker 與 SDK 兩種執行方式的 Gradio 行為一致。 | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt gradio==5.49.1 | |
| COPY app.py ./ | |
| COPY pdfcompress.py ./ | |
| COPY JapanColor2011Coated.icc ./ | |
| COPY sRGB_IEC61966-2-1_no_black_scaling.icc ./ | |
| # HF Spaces(Docker SDK)預設連到 7860,可用 app_port 覆寫 | |
| ARG APP_PORT=7860 | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" \ | |
| GRADIO_SERVER_PORT=${APP_PORT} \ | |
| PYTHONUNBUFFERED=1 | |
| EXPOSE ${APP_PORT} | |
| # 啟動應用(app.py 內已指定 server_name/server_port) | |
| CMD ["python", "app.py"] | |