diff --git a/.github/workflows/docker-ci.yaml b/.github/workflows/docker-ci.yaml index e81f1dd..e1d202e 100644 --- a/.github/workflows/docker-ci.yaml +++ b/.github/workflows/docker-ci.yaml @@ -119,8 +119,9 @@ jobs: TAGS="${IMAGE}:sha-${RELAY_SHA_SHORT}" if [ "$EVENT_NAME" = "push" ] || \ [ "$EVENT_NAME" = "pull_request" ]; then - # Docker-repo push/PR: add docker branch tag - TAGS="${TAGS}"$'\n'"${IMAGE}:${REF_NAME}" + # Docker-repo push/PR: add docker branch tag (sanitize slashes) + BRANCH_TAG=$(echo "${REF_NAME}" | sed 's|/|-|g') + TAGS="${TAGS}"$'\n'"${IMAGE}:${BRANCH_TAG}" else # Dispatch: tags based on relay ref BRANCH_TAG=$(echo "${RELAY_REF}" | sed 's|/|-|g') @@ -206,7 +207,6 @@ jobs: name: Integration test needs: build permissions: {} - if: github.event_name != 'pull_request' # TODO: revert to @main once cmlxc docker support is merged uses: chatmail/cmlxc/.github/workflows/lxc-test.yml@j4n/docker-support with: diff --git a/README.md b/README.md index 532274a..3ca5ffc 100644 --- a/README.md +++ b/README.md @@ -271,13 +271,13 @@ If you have an existing bare-metal chatmail installation and want to switch to D ## Development / Contributing -To develop or contribute to the Docker setup: - -Clone the relay repo and add this repository as a submodule: +Clone the relay repo and add this repository inside, then copy the `.dockerignore` and build: ```bash git clone https://github.com/chatmail/relay cd relay git clone https://github.com/chatmail/docker cd docker +cp .dockerignore .. +docker compose build ``` diff --git a/chatmail_relay.dockerfile b/chatmail_relay.dockerfile index 33640fd..8b6b480 100644 --- a/chatmail_relay.dockerfile +++ b/chatmail_relay.dockerfile @@ -1,5 +1,37 @@ # syntax=docker/dockerfile:1 -FROM jrei/systemd-debian:12 AS base + +# Build systemd-debian:12 base image locally +# Vendoring https://github.com/j8r/dockerfiles/blob/master/systemd/debian/Dockerfile thats behind +# https://hub.docker.com/r/jrei/systemd-debian/tags?name=bookworm +FROM debian:12 AS systemd-base + +ARG VERSION=12 + +ENV LC_ALL=C +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y systemd systemd-sysv \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN cd /lib/systemd/system/sysinit.target.wants/ \ + && rm $(ls | grep -v systemd-tmpfiles-setup) + +RUN rm -f /lib/systemd/system/multi-user.target.wants/* \ + /etc/systemd/system/*.wants/* \ + /lib/systemd/system/local-fs.target.wants/* \ + /lib/systemd/system/sockets.target.wants/*udev* \ + /lib/systemd/system/sockets.target.wants/*initctl* \ + /lib/systemd/system/basic.target.wants/* \ + /lib/systemd/system/anaconda.target.wants/* \ + /lib/systemd/system/plymouth* \ + /lib/systemd/system/systemd-update-utmp* + +VOLUME [ "/sys/fs/cgroup" ] + +# Main chatmail-relay image +FROM systemd-base AS base ENV LANG=en_US.UTF-8