- 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>
25 lines
997 B
Docker
25 lines
997 B
Docker
ARG TAG
|
|
FROM job79/base:${TAG}
|
|
USER root
|
|
|
|
RUN set -o pipefail && \
|
|
GO_VERSION=$(curl -fsSL "https://go.dev/VERSION?m=text" | head -n 1 | tr -d '\r\n') && \
|
|
curl -fsSL "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" | tar xz -C /usr/local && \
|
|
ln -sf /usr/local/go/bin/go /usr/local/go/bin/gofmt /usr/local/bin/
|
|
|
|
# Build caches live in cache mounts so they don't end up in the image.
|
|
RUN --mount=type=cache,id=go-mod,target=/root/go/pkg/mod \
|
|
--mount=type=cache,id=go-build,target=/root/.cache/go-build \
|
|
for pkg in \
|
|
golang.org/x/tools/gopls \
|
|
golang.org/x/tools/cmd/goimports \
|
|
mvdan.cc/gofumpt \
|
|
github.com/go-delve/delve/cmd/dlv; \
|
|
do GOBIN=/usr/local/bin go install "$pkg@latest" || exit 1; done
|
|
|
|
RUN --mount=type=cache,id=bun-cache,target=/root/.bun-cache \
|
|
BUN_INSTALL=/usr/local BUN_INSTALL_CACHE_DIR=/root/.bun-cache bun install -g \
|
|
typescript typescript-language-server @tailwindcss/language-server svelte-language-server @biomejs/biome
|
|
|
|
USER user
|