| Philip Zeyliger | a442ce3 | 2025-05-28 02:48:26 +0000 | [diff] [blame] | 1 | FROM ubuntu:24.04 |
| Philip Zeyliger | 9df94b5 | 2025-05-18 03:43:14 +0000 | [diff] [blame] | 2 | |
| 3 | # Switch from dash to bash by default. |
| 4 | SHELL ["/bin/bash", "-euxo", "pipefail", "-c"] |
| 5 | |
| 6 | # attempt to keep package installs lean |
| 7 | RUN printf '%s\n' \ |
| 8 | 'path-exclude=/usr/share/man/*' \ |
| 9 | 'path-exclude=/usr/share/doc/*' \ |
| 10 | 'path-exclude=/usr/share/doc-base/*' \ |
| 11 | 'path-exclude=/usr/share/info/*' \ |
| 12 | 'path-exclude=/usr/share/locale/*' \ |
| 13 | 'path-exclude=/usr/share/groff/*' \ |
| 14 | 'path-exclude=/usr/share/lintian/*' \ |
| 15 | 'path-exclude=/usr/share/zoneinfo/*' \ |
| 16 | > /etc/dpkg/dpkg.cfg.d/01_nodoc |
| 17 | |
| Philip Zeyliger | a442ce3 | 2025-05-28 02:48:26 +0000 | [diff] [blame] | 18 | # Install system packages including ca-certificates for Go downloads |
| Philip Zeyliger | 9df94b5 | 2025-05-18 03:43:14 +0000 | [diff] [blame] | 19 | RUN apt-get update; \ |
| 20 | apt-get install -y --no-install-recommends \ |
| Philip Zeyliger | a442ce3 | 2025-05-28 02:48:26 +0000 | [diff] [blame] | 21 | ca-certificates wget \ |
| Philip Zeyliger | 9df94b5 | 2025-05-18 03:43:14 +0000 | [diff] [blame] | 22 | git jq sqlite3 npm nodejs gh ripgrep fzf python3 curl vim chromium lsof iproute2 less && \ |
| 23 | apt-get clean && \ |
| 24 | rm -rf /var/lib/apt/lists/* && \ |
| 25 | rm -rf /usr/share/{doc,doc-base,info,lintian,man,groff,locale,zoneinfo}/* |
| 26 | |
| Philip Zeyliger | a442ce3 | 2025-05-28 02:48:26 +0000 | [diff] [blame] | 27 | # Install Go 1.24 |
| 28 | ENV GO_VERSION=1.24.3 |
| 29 | ENV GOROOT=/usr/local/go |
| 30 | ENV GOPATH=/go |
| 31 | ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH |
| 32 | |
| 33 | RUN ARCH=$(uname -m) && \ |
| 34 | case $ARCH in \ |
| 35 | x86_64) GOARCH=amd64 ;; \ |
| 36 | aarch64) GOARCH=arm64 ;; \ |
| 37 | *) echo "Unsupported architecture: $ARCH" && exit 1 ;; \ |
| 38 | esac && \ |
| 39 | wget -O go.tar.gz "https://golang.org/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz" && \ |
| 40 | tar -C /usr/local -xzf go.tar.gz && \ |
| 41 | rm go.tar.gz |
| 42 | |
| 43 | # Create GOPATH directory |
| 44 | RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 755 "$GOPATH" |
| Philip Zeyliger | 9df94b5 | 2025-05-18 03:43:14 +0000 | [diff] [blame] | 45 | |
| 46 | # While these binaries install generally useful supporting packages, |
| 47 | # the specific versions are rarely what a user wants so there is no |
| 48 | # point polluting the base image module with them. |
| 49 | |
| 50 | RUN go install golang.org/x/tools/cmd/goimports@latest; \ |
| 51 | go install golang.org/x/tools/gopls@latest; \ |
| 52 | go install mvdan.cc/gofumpt@latest; \ |
| 53 | go clean -cache -testcache -modcache |
| 54 | |
| 55 | ENV GOTOOLCHAIN=auto |
| 56 | ENV SKETCH=1 |
| 57 | |
| 58 | RUN mkdir -p /root/.cache/sketch/webui |