|
| 1 | +# syntax=docker/dockerfile:1 |
| 2 | + |
| 3 | +# Claude Code ships as a single binary, so this port has an `http` source rather |
| 4 | +# than a parent image: it has no base image (no FROM ${BASE}), so the base is |
| 5 | +# chosen here. clade injects the selected version as the BASE_TAG build-arg, and |
| 6 | +# a rebuild is triggered whenever the stable release advances (its primary |
| 7 | +# {{.Major}}.{{.Minor}}.{{.Patch}} tag goes missing in the destination repo). |
| 8 | +FROM docker.io/library/debian:bookworm-slim |
| 9 | + |
| 10 | +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| 11 | + --mount=type=cache,target=/var/lib/apt,sharing=locked \ |
| 12 | + rm -f /etc/apt/apt.conf.d/docker-clean \ |
| 13 | + && export DEBIAN_FRONTEND=noninteractive \ |
| 14 | + && apt-get update \ |
| 15 | + && apt-get install -y --no-install-recommends \ |
| 16 | + ca-certificates \ |
| 17 | + curl \ |
| 18 | + git \ |
| 19 | + jq |
| 20 | + |
| 21 | +# Install Claude Code from the official release channel. clade injects the |
| 22 | +# resolved stable version as BASE_TAG; for that version we read the manifest to |
| 23 | +# get the per-platform checksum, download the binary, and verify it before use. |
| 24 | +# The base image is glibc (debian), so the platform is linux-<arch> (no -musl). |
| 25 | +ARG BASE_TAG |
| 26 | +RUN set -eu; \ |
| 27 | + case "$(uname -m)" in \ |
| 28 | + x86_64 | amd64) arch="x64" ;; \ |
| 29 | + arm64 | aarch64) arch="arm64" ;; \ |
| 30 | + *) echo "Unsupported architecture: $(uname -m)" >&2; exit 1 ;; \ |
| 31 | + esac; \ |
| 32 | + platform="linux-${arch}"; \ |
| 33 | + base_url="https://downloads.claude.ai/claude-code-releases"; \ |
| 34 | + manifest="$(curl -fsSL "${base_url}/${BASE_TAG}/manifest.json")"; \ |
| 35 | + checksum="$(printf '%s' "${manifest}" | jq -r ".platforms[\"${platform}\"].checksum // empty")"; \ |
| 36 | + [ -n "${checksum}" ] || { echo "Platform ${platform} not found in manifest" >&2; exit 1; }; \ |
| 37 | + out=/usr/local/bin/claude; \ |
| 38 | + curl -fsSL -o "${out}" "${base_url}/${BASE_TAG}/${platform}/claude"; \ |
| 39 | + printf '%s %s\n' "${checksum}" "${out}" | sha256sum -c -; \ |
| 40 | + chmod +x "${out}"; \ |
| 41 | + claude --version |
| 42 | +
|
| 43 | +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ |
| 44 | + --mount=type=cache,target=/var/lib/apt,sharing=locked \ |
| 45 | + rm -f /etc/apt/apt.conf.d/docker-clean \ |
| 46 | + && export DEBIAN_FRONTEND=noninteractive \ |
| 47 | + && apt-get update \ |
| 48 | + && apt-get install -y --no-install-recommends \ |
| 49 | + python3 \ |
| 50 | + python3-pip \ |
| 51 | + && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ |
| 52 | + && locale-gen |
| 53 | +
|
| 54 | +{{ template "user.dockerfile" . }} |
0 commit comments