[CLAUDE] wkhtmltopdfをaptではなくバイナリから直接インストールするように変更#378
Conversation
プロンプト: ベースイメージの ruby:4.0.2 では、Trixieベースですが wkhtmltopdf がaptで入れられなくなっています。直接バイナリをインストールするように、Dockerfileを書き換えてください。 修正内容: - aptパッケージ一覧からwkhtmltopdfを削除 - wkhtmltopdf 0.12.6.1-3のbookworm向けdebパッケージをGitHub Releasesからダウンロードし、dpkgでインストールするRUNステップを追加 - Debian Trixie(ruby:4.0.2-slimのベース)ではwkhtmltopdfがaptリポジトリに存在しないため、直接バイナリインストールに切り替えた Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Debian Trixie ベースの ruby:4.0.2-slim で wkhtmltopdf を apt から入れられなくなったため、GitHub Releases の .deb を直接取得してインストールするよう Dockerfile を更新するPRです。
Changes:
- apt のインストール対象から
wkhtmltopdfを削除 wkhtmltox_0.12.6.1-3.bookworm_amd64.debをダウンロードしてインストールする RUN ステップを追加- apt キャッシュ/リスト削除を追加ステップ側にも適用
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # Install wkhtmltopdf from binary (not available via apt on Debian Trixie) | ||
| RUN curl -fsSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb -o /tmp/wkhtmltox.deb && \ |
There was a problem hiding this comment.
The downloaded .deb is installed without any integrity verification. Please pin and validate the artifact (e.g., verify a published SHA256 checksum or signature) to reduce supply-chain risk and avoid silently installing a tampered binary if the URL is ever compromised.
| # Install wkhtmltopdf from binary (not available via apt on Debian Trixie) | |
| RUN curl -fsSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb -o /tmp/wkhtmltox.deb && \ | |
| ARG WKHTMLTOX_DEB_SHA256=<published_sha256_for_wkhtmltox_0.12.6.1-3.bookworm_amd64.deb> | |
| # Install wkhtmltopdf from binary (not available via apt on Debian Trixie) | |
| RUN curl -fsSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb -o /tmp/wkhtmltox.deb && \ | |
| echo "${WKHTMLTOX_DEB_SHA256} /tmp/wkhtmltox.deb" | sha256sum -c - && \ |
| # Install wkhtmltopdf from binary (not available via apt on Debian Trixie) | ||
| RUN curl -fsSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb -o /tmp/wkhtmltox.deb && \ |
There was a problem hiding this comment.
This hard-codes the Bookworm amd64 package, which will fail when building on arm64 (common on Apple Silicon) or when using buildx multi-platform builds. Consider selecting the download URL based on TARGETARCH (and failing fast for unsupported arches) or otherwise documenting/enforcing amd64-only builds.
| # Install wkhtmltopdf from binary (not available via apt on Debian Trixie) | |
| RUN curl -fsSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb -o /tmp/wkhtmltox.deb && \ | |
| ARG TARGETARCH | |
| # Install wkhtmltopdf from binary (not available via apt on Debian Trixie) | |
| RUN case "${TARGETARCH}" in \ | |
| amd64) wkhtmltox_arch=amd64 ;; \ | |
| arm64) wkhtmltox_arch=arm64 ;; \ | |
| *) echo "Unsupported TARGETARCH for wkhtmltopdf: ${TARGETARCH}" >&2; exit 1 ;; \ | |
| esac && \ | |
| curl -fsSL "https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_${wkhtmltox_arch}.deb" -o /tmp/wkhtmltox.deb && \ |
| RUN apt-get update -qq && \ | ||
| apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 wkhtmltopdf fonts-noto-cjk fonts-noto-color-emoji && \ | ||
| apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 fonts-noto-cjk fonts-noto-color-emoji && \ | ||
| rm -rf /var/lib/apt/lists /var/cache/apt/archives | ||
|
|
||
| # Install wkhtmltopdf from binary (not available via apt on Debian Trixie) | ||
| RUN curl -fsSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb -o /tmp/wkhtmltox.deb && \ | ||
| apt-get update -qq && \ | ||
| apt-get install --no-install-recommends -y /tmp/wkhtmltox.deb && \ | ||
| rm -rf /tmp/wkhtmltox.deb /var/lib/apt/lists /var/cache/apt/archives |
There was a problem hiding this comment.
The base stage now runs apt-get update twice in separate layers (once for base packages, again for wkhtmltopdf). To reduce build time and layer count, consider combining the wkhtmltopdf install into the existing base-packages RUN step (keeping a single apt-get update and a single cleanup).
プロンプト:
ベースイメージの ruby:4.0.2 では、Trixieベースですが wkhtmltopdf がaptで入れられなくなっています。直接バイナリをインストールするように、Dockerfileを書き換えてください。
修正内容: