blob: 524a66ce6993be6904908e4a291f3ce1f25c4254 [file] [log] [blame]
# Stage 1: Get Chrome/Chromium from chromedp/headless-shell
FROM docker.io/chromedp/headless-shell:stable AS chrome
# Stage 2: Main application image
FROM ubuntu:24.04
# Switch from dash to bash by default.
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
# attempt to keep package installs lean
RUN printf '%s\n' \
'path-exclude=/usr/share/man/*' \
'path-exclude=/usr/share/doc/*' \
'path-exclude=/usr/share/doc-base/*' \
'path-exclude=/usr/share/info/*' \
'path-exclude=/usr/share/locale/*' \
'path-exclude=/usr/share/groff/*' \
'path-exclude=/usr/share/lintian/*' \
'path-exclude=/usr/share/zoneinfo/*' \
> /etc/dpkg/dpkg.cfg.d/01_nodoc
# Install system packages (removed chromium, will use headless-shell instead)
RUN apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates wget \
git jq sqlite3 npm nodejs gh ripgrep fzf python3 curl vim lsof iproute2 less \
docker.io docker-compose-v2 docker-buildx \
make python3-pip python-is-python3 tree net-tools file build-essential \
pipx cargo psmisc bsdmainutils openssh-client sudo \
unzip yarn util-linux \
libglib2.0-0 libnss3 libx11-6 libxcomposite1 libxdamage1 \
libxext6 libxi6 libxrandr2 libgbm1 libgtk-3-0 \
fonts-noto-color-emoji fonts-symbola && \
fc-cache -f -v && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /usr/share/{doc,doc-base,info,lintian,man,groff,locale,zoneinfo}/*
RUN echo '{"storage-driver":"vfs", "bridge":"none", "iptables":false, "ip-forward": false}' \
> /etc/docker/daemon.json
# Install Go 1.24
ENV GO_VERSION=1.24.3
ENV GOROOT=/usr/local/go
ENV GOPATH=/go
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
RUN ARCH=$(uname -m) && \
case $ARCH in \
x86_64) GOARCH=amd64 ;; \
aarch64) GOARCH=arm64 ;; \
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
esac && \
wget -O go.tar.gz "https://golang.org/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz" && \
tar -C /usr/local -xzf go.tar.gz && \
rm go.tar.gz
# Create GOPATH directory
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 755 "$GOPATH"
# While these binaries install generally useful supporting packages,
# the specific versions are rarely what a user wants so there is no
# point polluting the base image module with them.
RUN go install golang.org/x/tools/cmd/goimports@latest; \
go install golang.org/x/tools/gopls@latest; \
go install mvdan.cc/gofumpt@latest; \
go clean -cache -testcache -modcache
# Copy the self-contained Chrome bundle from chromedp/headless-shell
COPY --from=chrome /headless-shell /headless-shell
ENV PATH="/headless-shell:${PATH}"
ENV GOTOOLCHAIN=auto
ENV SKETCH=1
RUN mkdir -p /root/.cache/sketch/webui