grim/hgkeeper

Use Alpine for Dockerfile

10 months ago, aklitzing
274e125f308b
Parents 102c70d8eaef
Children ae75fb1d8de7
Use Alpine for Dockerfile

Also use mercurial from Alpine repository as it is up-to-date and enables
rust extensions and chg binary.

This decreases the size of docker image.

Reviewed at https://reviews.imfreedom.org/r/2454/
  • +1 -1
    .dockerignore
  • +10 -17
    Dockerfile
  • --- a/.dockerignore Tue May 23 00:37:51 2023 -0500
    +++ b/.dockerignore Wed Jun 14 03:43:03 2023 -0500
    @@ -1,3 +1,3 @@
    repos/
    host-keys/
    -
    +Dockerfile
    --- a/Dockerfile Tue May 23 00:37:51 2023 -0500
    +++ b/Dockerfile Wed Jun 14 03:43:03 2023 -0500
    @@ -1,4 +1,4 @@
    -FROM docker.io/golang:1.20-bullseye as build
    +FROM docker.io/golang:1.20-alpine as build
    WORKDIR /root
    @@ -6,28 +6,21 @@
    RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static" -s' .
    -FROM debian:bullseye-slim
    +FROM alpine:3
    ENV HGKEEPER_THEME_URL=https://keep.imfreedom.org/grim/hgkeeper-theme/archive/default.tar.gz
    RUN set -ex && \
    - apt-get update && \
    - apt-get install -y --no-install-recommends \
    - python3 libpython3-dev python3-pip python3-setuptools python3-pygments \
    - build-essential openssh-client libffi7 libffi-dev nvi procps wget \
    - && \
    - pip3 install --no-binary :all: mercurial hg-evolve hgwebplus && \
    - apt-get remove -y --purge \
    - libpython3-dev python3-pip python3-setuptools build-essential \
    - libffi-dev \
    - && \
    - apt-get autoremove --purge -y && \
    - apt-get clean && \
    - rm -rf /var/lib/apt/lists
    + apk upgrade --available --update-cache && \
    + apk add py3-pygments openssh-client mercurial-chg procps && \
    + apk add --virtual deps python3-dev py3-pip py3-setuptools build-base && \
    + pip3 install --no-binary :all: hg-evolve hgwebplus && rm -r ~/.cache && \
    + apk del deps && \
    + rm -rf /var/cache/apk
    RUN set -ex && \
    - groupadd -g 22271 hg && \
    - useradd -m -d /var/lib/hg -u 22271 -g hg hg
    + addgroup -g 22271 hg && \
    + adduser -D -h /var/lib/hg -u 22271 -G hg hg
    # install the hgkeeper theme
    RUN set -ex && \