dockerimg: Extract base Dockerfile to separate file
Extract the dockerfileBase constant into a Dockerfile.base file and use Go embed
directives to include it in the code. This improves maintainability by separating
the Docker configuration from the Go code while preserving the same functionality.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: se66b902985dca8a1k
diff --git a/dockerimg/Dockerfile.base b/dockerimg/Dockerfile.base
new file mode 100644
index 0000000..ca16e5c
--- /dev/null
+++ b/dockerimg/Dockerfile.base
@@ -0,0 +1,39 @@
+FROM golang:1.24-bookworm
+
+# 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
+
+RUN apt-get update; \
+ apt-get install -y --no-install-recommends \
+ git jq sqlite3 npm nodejs gh ripgrep fzf python3 curl vim chromium lsof iproute2 less && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/* && \
+ rm -rf /usr/share/{doc,doc-base,info,lintian,man,groff,locale,zoneinfo}/*
+
+ENV PATH="$GOPATH/bin:$PATH"
+
+# 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
+
+ENV GOTOOLCHAIN=auto
+ENV SKETCH=1
+
+RUN mkdir -p /root/.cache/sketch/webui
\ No newline at end of file