| Philip Zeyliger | 9500617 | 2025-05-28 20:05:46 -0700 | [diff] [blame] | 1 | # Stage 1: Get Chrome/Chromium from chromedp/headless-shell |
| 2 | FROM docker.io/chromedp/headless-shell:stable AS chrome |
| 3 | |
| 4 | # Stage 2: Main application image |
| Philip Zeyliger | a442ce3 | 2025-05-28 02:48:26 +0000 | [diff] [blame] | 5 | FROM ubuntu:24.04 |
| Philip Zeyliger | 9df94b5 | 2025-05-18 03:43:14 +0000 | [diff] [blame] | 6 | |
| 7 | # Switch from dash to bash by default. |
| 8 | SHELL ["/bin/bash", "-euxo", "pipefail", "-c"] |
| 9 | |
| 10 | # attempt to keep package installs lean |
| 11 | RUN printf '%s\n' \ |
| 12 | 'path-exclude=/usr/share/man/*' \ |
| 13 | 'path-exclude=/usr/share/doc/*' \ |
| 14 | 'path-exclude=/usr/share/doc-base/*' \ |
| 15 | 'path-exclude=/usr/share/info/*' \ |
| 16 | 'path-exclude=/usr/share/locale/*' \ |
| 17 | 'path-exclude=/usr/share/groff/*' \ |
| 18 | 'path-exclude=/usr/share/lintian/*' \ |
| 19 | 'path-exclude=/usr/share/zoneinfo/*' \ |
| 20 | > /etc/dpkg/dpkg.cfg.d/01_nodoc |
| 21 | |
| Philip Zeyliger | 9500617 | 2025-05-28 20:05:46 -0700 | [diff] [blame] | 22 | # Install system packages (removed chromium, will use headless-shell instead) |
| Philip Zeyliger | 9df94b5 | 2025-05-18 03:43:14 +0000 | [diff] [blame] | 23 | RUN apt-get update; \ |
| 24 | apt-get install -y --no-install-recommends \ |
| Philip Zeyliger | a442ce3 | 2025-05-28 02:48:26 +0000 | [diff] [blame] | 25 | ca-certificates wget \ |
| Philip Zeyliger | 9500617 | 2025-05-28 20:05:46 -0700 | [diff] [blame] | 26 | git jq sqlite3 npm nodejs gh ripgrep fzf python3 curl vim lsof iproute2 less \ |
| David Crawshaw | 0258add | 2025-06-18 09:26:09 -0700 | [diff] [blame] | 27 | docker.io docker-compose-v2 docker-buildx \ |
| philip.zeyliger | 2ca1f10 | 2025-07-02 22:17:00 +0000 | [diff] [blame] | 28 | make python3-pip python-is-python3 tree net-tools file build-essential \ |
| 29 | pipx cargo psmisc bsdmainutils openssh-client sudo \ |
| 30 | unzip yarn util-linux \ |
| Philip Zeyliger | 9500617 | 2025-05-28 20:05:46 -0700 | [diff] [blame] | 31 | libglib2.0-0 libnss3 libx11-6 libxcomposite1 libxdamage1 \ |
| Josh Bleecher Snyder | c7cdd77 | 2025-05-29 19:43:10 +0000 | [diff] [blame] | 32 | libxext6 libxi6 libxrandr2 libgbm1 libgtk-3-0 \ |
| 33 | fonts-noto-color-emoji fonts-symbola && \ |
| 34 | fc-cache -f -v && \ |
| Philip Zeyliger | 9df94b5 | 2025-05-18 03:43:14 +0000 | [diff] [blame] | 35 | apt-get clean && \ |
| 36 | rm -rf /var/lib/apt/lists/* && \ |
| 37 | rm -rf /usr/share/{doc,doc-base,info,lintian,man,groff,locale,zoneinfo}/* |
| 38 | |
| David Crawshaw | 0258add | 2025-06-18 09:26:09 -0700 | [diff] [blame] | 39 | RUN echo '{"storage-driver":"vfs", "bridge":"none", "iptables":false, "ip-forward": false}' \ |
| 40 | > /etc/docker/daemon.json |
| 41 | |
| Philip Zeyliger | a442ce3 | 2025-05-28 02:48:26 +0000 | [diff] [blame] | 42 | # Install Go 1.24 |
| 43 | ENV GO_VERSION=1.24.3 |
| 44 | ENV GOROOT=/usr/local/go |
| 45 | ENV GOPATH=/go |
| 46 | ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH |
| 47 | |
| 48 | RUN ARCH=$(uname -m) && \ |
| 49 | case $ARCH in \ |
| 50 | x86_64) GOARCH=amd64 ;; \ |
| 51 | aarch64) GOARCH=arm64 ;; \ |
| 52 | *) echo "Unsupported architecture: $ARCH" && exit 1 ;; \ |
| 53 | esac && \ |
| 54 | wget -O go.tar.gz "https://golang.org/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz" && \ |
| 55 | tar -C /usr/local -xzf go.tar.gz && \ |
| 56 | rm go.tar.gz |
| 57 | |
| 58 | # Create GOPATH directory |
| 59 | RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 755 "$GOPATH" |
| Philip Zeyliger | 9df94b5 | 2025-05-18 03:43:14 +0000 | [diff] [blame] | 60 | |
| 61 | # While these binaries install generally useful supporting packages, |
| 62 | # the specific versions are rarely what a user wants so there is no |
| 63 | # point polluting the base image module with them. |
| 64 | |
| 65 | RUN go install golang.org/x/tools/cmd/goimports@latest; \ |
| 66 | go install golang.org/x/tools/gopls@latest; \ |
| 67 | go install mvdan.cc/gofumpt@latest; \ |
| 68 | go clean -cache -testcache -modcache |
| 69 | |
| Philip Zeyliger | 9500617 | 2025-05-28 20:05:46 -0700 | [diff] [blame] | 70 | # Copy the self-contained Chrome bundle from chromedp/headless-shell |
| 71 | COPY --from=chrome /headless-shell /headless-shell |
| 72 | ENV PATH="/headless-shell:${PATH}" |
| 73 | |
| Philip Zeyliger | 9df94b5 | 2025-05-18 03:43:14 +0000 | [diff] [blame] | 74 | ENV GOTOOLCHAIN=auto |
| 75 | ENV SKETCH=1 |
| 76 | |
| David Crawshaw | 0258add | 2025-06-18 09:26:09 -0700 | [diff] [blame] | 77 | RUN mkdir -p /root/.cache/sketch/webui |