Skip to content

[CLAUDE] wkhtmltopdfをaptではなくバイナリから直接インストールするように変更#378

Merged
kinoppyd merged 1 commit intomainfrom
fixes/wkhtmltopdf
Apr 13, 2026
Merged

[CLAUDE] wkhtmltopdfをaptではなくバイナリから直接インストールするように変更#378
kinoppyd merged 1 commit intomainfrom
fixes/wkhtmltopdf

Conversation

@kinoppyd
Copy link
Copy Markdown
Member

プロンプト:
ベースイメージの 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リポジトリに存在しないため、直接バイナリインストールに切り替えた

プロンプト:
ベースイメージの 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Debian Trixie ベースの ruby:4.0.2-slimwkhtmltopdf を 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.

Comment thread Dockerfile
Comment on lines 21 to +23

# 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 && \
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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 - && \

Copilot uses AI. Check for mistakes.
Comment thread Dockerfile
Comment on lines +22 to +23
# 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 && \
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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 && \

Copilot uses AI. Check for mistakes.
Comment thread Dockerfile
Comment on lines 18 to +26
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
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
@kinoppyd kinoppyd merged commit 3e0322a into main Apr 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants