blob: 3d1b56a9af67542802d128f17959c2853e8fb909 [file] [log] [blame]
Philip Zeyliger95006172025-05-28 20:05:46 -07001# Stage 1: Get Chrome/Chromium from chromedp/headless-shell
2FROM docker.io/chromedp/headless-shell:stable AS chrome
3
4# Stage 2: Main application image
Philip Zeyligera442ce32025-05-28 02:48:26 +00005FROM ubuntu:24.04
Philip Zeyliger9df94b52025-05-18 03:43:14 +00006
7# Switch from dash to bash by default.
8SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
9
10# attempt to keep package installs lean
11RUN 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 Zeyliger95006172025-05-28 20:05:46 -070022# Install system packages (removed chromium, will use headless-shell instead)
Philip Zeyliger9df94b52025-05-18 03:43:14 +000023RUN apt-get update; \
24 apt-get install -y --no-install-recommends \
Philip Zeyligera442ce32025-05-28 02:48:26 +000025 ca-certificates wget \
Philip Zeyliger95006172025-05-28 20:05:46 -070026 git jq sqlite3 npm nodejs gh ripgrep fzf python3 curl vim lsof iproute2 less \
David Crawshaw0258add2025-06-18 09:26:09 -070027 docker.io docker-compose-v2 docker-buildx \
Philip Zeyliger95006172025-05-28 20:05:46 -070028 libglib2.0-0 libnss3 libx11-6 libxcomposite1 libxdamage1 \
Josh Bleecher Snyderc7cdd772025-05-29 19:43:10 +000029 libxext6 libxi6 libxrandr2 libgbm1 libgtk-3-0 \
30 fonts-noto-color-emoji fonts-symbola && \
31 fc-cache -f -v && \
Philip Zeyliger9df94b52025-05-18 03:43:14 +000032 apt-get clean && \
33 rm -rf /var/lib/apt/lists/* && \
34 rm -rf /usr/share/{doc,doc-base,info,lintian,man,groff,locale,zoneinfo}/*
35
David Crawshaw0258add2025-06-18 09:26:09 -070036RUN echo '{"storage-driver":"vfs", "bridge":"none", "iptables":false, "ip-forward": false}' \
37 > /etc/docker/daemon.json
38
Philip Zeyligera442ce32025-05-28 02:48:26 +000039# Install Go 1.24
40ENV GO_VERSION=1.24.3
41ENV GOROOT=/usr/local/go
42ENV GOPATH=/go
43ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
44
45RUN ARCH=$(uname -m) && \
46 case $ARCH in \
47 x86_64) GOARCH=amd64 ;; \
48 aarch64) GOARCH=arm64 ;; \
49 *) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
50 esac && \
51 wget -O go.tar.gz "https://golang.org/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz" && \
52 tar -C /usr/local -xzf go.tar.gz && \
53 rm go.tar.gz
54
55# Create GOPATH directory
56RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 755 "$GOPATH"
Philip Zeyliger9df94b52025-05-18 03:43:14 +000057
58# While these binaries install generally useful supporting packages,
59# the specific versions are rarely what a user wants so there is no
60# point polluting the base image module with them.
61
62RUN go install golang.org/x/tools/cmd/goimports@latest; \
63 go install golang.org/x/tools/gopls@latest; \
64 go install mvdan.cc/gofumpt@latest; \
65 go clean -cache -testcache -modcache
66
Philip Zeyliger95006172025-05-28 20:05:46 -070067# Copy the self-contained Chrome bundle from chromedp/headless-shell
68COPY --from=chrome /headless-shell /headless-shell
69ENV PATH="/headless-shell:${PATH}"
70
Philip Zeyliger9df94b52025-05-18 03:43:14 +000071ENV GOTOOLCHAIN=auto
72ENV SKETCH=1
73
David Crawshaw0258add2025-06-18 09:26:09 -070074RUN mkdir -p /root/.cache/sketch/webui