FROM docker.io/golang:1.22-alpine as build RUN CGO_ENABLED=0 GOOS=linux
go
build
-a
-ldflags
'-extldflags "-static" -s' .
ENV HGKEEPER_THEME_URL=https://keep.imfreedom.org/grim/hgkeeper-theme/archive/default.tar.gz
apk
upgrade
--available
--update-cache
&& \ apk
add
py3-pygments
openssh-client
mercurial-chg
procps
curl
ca-certificates
&& \ apk
add
--virtual
deps
python3-dev
py3-pip
py3-setuptools
build-base
&& \ pip3
install
--break-system-packages
--no-binary
:all:
hg-evolve
hgwebplus
&& rm
-r
~/.cache
&& \ addgroup
-g
22271 hg
&& \ adduser
-D
-h
/var/lib/hg
-u
22271 -G
hg
hg
# install the hgkeeper theme wget
-O
-
"${HGKEEPER_THEME_URL}" | tar
zx
&& \ HGINST=$(python3
-c
'import mercurial; print(mercurial.__path__[0])') && \ cp
-a
/tmp/hgkeeper-theme-default/templates/hgkeeper/
$HGINST/templates/
&& \ cp
-a
/tmp/hgkeeper-theme-default/templates/static/hgk/
$HGINST/templates/static/
&& \ rm
-rf
/tmp/hgkeeper-theme-default
# setup the global mercurial configuration COPY hgrc
/etc/mercurial/hgrc
COPY --from
=build
/root/hgkeeper
/usr/local/bin/hgkeeper
CMD ["hgkeeper", "serve"]