perf: shrink images and harden downloads

- Keep Go module/build and bun caches in cache mounts instead of layers.
- Split base tool downloads into layers ordered by change frequency.
- Use curl -f and pipefail so failed downloads break the build.
- Resolve the lazygit version from the release redirect instead of the
  rate-limited GitHub API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-08 11:46:59 +01:00
1 parent 0397174460
commit 9c6569fa29
2 files changed
+32 -15

No files matched your search

+14 -6
View File
@@ -7,12 +7,20 @@ RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \
bash-completion git-core fzf curl awk jq rg unzip which \
host-spawn wl-copy gcc tree-sitter-cli
RUN LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | jq -r .tag_name | sed 's/^v//') && \
curl -sL "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_linux_x86_64.tar.gz" | tar xz -C /usr/local/bin lazygit && \
curl -sL "https://github.com/jorgerojas26/lazysql/releases/latest/download/lazysql_Linux_x86_64.tar.gz" | tar xz -C /usr/local/bin lazysql && \
curl -sL "https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz" | tar xz -C /usr/local --strip-components=1 && \
curl -fsSL https://bun.sh/install | BUN_INSTALL="/usr/local" bash && \
ln -sf /usr/local/bin/bun /usr/local/bin/node && \
# === install tools (least to most frequently changing) ===
RUN set -o pipefail && \
LAZYGIT_URL=$(curl -fsSLI -o /dev/null -w '%{url_effective}' https://github.com/jesseduffield/lazygit/releases/latest) && \
curl -fsSL "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_URL##*/v}_linux_x86_64.tar.gz" | tar xz -C /usr/local/bin lazygit && \
curl -fsSL "https://github.com/jorgerojas26/lazysql/releases/latest/download/lazysql_Linux_x86_64.tar.gz" | tar xz -C /usr/local/bin lazysql
RUN set -o pipefail && \
curl -fsSL https://bun.sh/install | BUN_INSTALL=/usr/local bash && \
ln -sf /usr/local/bin/bun /usr/local/bin/node
RUN set -o pipefail && \
curl -fsSL https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz | tar xz -C /usr/local --strip-components=1
RUN set -o pipefail && \
curl -fsSL https://claude.ai/install.sh | bash && \
cp -L /root/.local/bin/claude /usr/local/bin/ && \
rm -rf /root/.local