diff --git a/.github/workflows/trixie-dev.yml b/.github/workflows/trixie-dev.yml index 0951119..b03ea84 100644 --- a/.github/workflows/trixie-dev.yml +++ b/.github/workflows/trixie-dev.yml @@ -5,7 +5,6 @@ name: 'trixie-dev' on: pull_request: - branches-ignore: [main] paths: - '.github/workflows/trixie-dev.yml' - '.github/workflows/prek_checks.yml' @@ -14,9 +13,10 @@ on: workflow_dispatch: env: - DESCRIPTION: 'Creative Commons (CC) Debian 13 (trixie) development' + DESCRIPTION: >- + 'Creative Commons (CC) Debian 13 (trixie) with runint [development]' OCI: 'org.opencontainers.image' - TITLE: 'CC Debian trixie (development)' + TITLE: 'CC Debian trixie [development]' URL: 'https://github.com/creativecommons/containers/trixie' VENDOR: 'Creative Commons' @@ -92,7 +92,7 @@ jobs: # https://github.com/docker/build-push-action - - name: Build and push Docker trixie image to GHCR + - name: Build and push Docker image to GHCR # build-push-action v7.4.0 uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc with: diff --git a/.github/workflows/trixie-msmtp-dev.yml b/.github/workflows/trixie-msmtp-dev.yml new file mode 100644 index 0000000..17a8954 --- /dev/null +++ b/.github/workflows/trixie-msmtp-dev.yml @@ -0,0 +1,109 @@ +# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax +# https://docs.github.com/en/actions/reference/workflows-and-actions/variables +name: 'trixie-msmtp-dev' +# GHCR: GitHub Container Registry + +on: + pull_request: + paths: + - '.github/workflows/trixie-msmtp-dev.yml' + - '.github/workflows/prek_checks.yml' + - 'trixie-msmtp/' + - '!trixie/README.md' + workflow_dispatch: + +env: + DESCRIPTION: >- + 'Creative Commons (CC) Debian 13 (trixie) with msmtp [development]' + OCI: 'org.opencontainers.image' + TITLE: 'CC Debian trixie with msmtp [development]' + URL: 'https://github.com/creativecommons/containers/trixie' + VENDOR: 'Creative Commons' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + + prek_checks: + uses: $/.github/workflows/prek_checks.yml + + build_and_push: + needs: prek_checks + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + + steps: + + - parallel: + + # https://github.com/docker/login-action + - name: Docker login to GitHub Container Registry (GHCR) + # docker/login-action v4.8.0 + uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # https://github.com/docker/metadata-action + - name: Docker extract metadata + id: docker_meta + env: + DOCKER_METADATA_ANNOTATIONS_LEVELS: index + # docker/metadata-action v6.2.0 + uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 + with: + annotations: | + ${{ env.OCI }}.created={{ date 'YYYY-MM-DDTHH:mm:ss.SSS[Z]' }} + ${{ env.OCI }}.description=${{ env.DESCRIPTION }} + ${{ env.OCI }}.source=${{ env.URL }} + ${{ env.OCI }}.title=${{ env.TITLE }} + ${{ env.OCI }}.url=${{ env.URL }} + ${{ env.OCI }}.vendor=${{ env.VENDOR }} + images: ghcr.io/creativecommons/trixie-msmtp-dev + # https://specs.opencontainers.org/image-spec/annotations/ + labels: | + ${{ env.OCI }}.created={{ date 'YYYY-MM-DDTHH:mm:ss.SSS[Z]' }} + ${{ env.OCI }}.description=${{ env.DESCRIPTION }} + ${{ env.OCI }}.source=${{ env.URL }} + ${{ env.OCI }}.title=${{ env.TITLE }} + ${{ env.OCI }}.url=${{ env.URL }} + ${{ env.OCI }}.vendor=${{ env.VENDOR }} + tags: | + type=ref,event=pr,suffix=-{{ sha }} + + # https://github.com/docker/setup-buildx-action + - name: Docker setup Buildx + id: docker_buildx + # docker/setup-buildx-action v4.4.1 + uses: >- + docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 + with: + platforms: linux/amd64,linux/arm64 + + # https://github.com/actions/checkout + - name: GitHub checkout repository + # actions/checkout v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + + + # https://github.com/docker/build-push-action + - name: Build and push Docker image to GHCR + # build-push-action v7.4.0 + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc + with: + annotations: ${{ steps.docker_meta.outputs.annotations }} + builder: ${{ steps.docker_buildx.outputs.name }} + cache-from: type=gha + cache-to: type=gha,mode=max + context: trixie-msmtp + labels: ${{ steps.docker_meta.outputs.labels }} + platforms: ${{ steps.docker_buildx.outputs.platforms }} + provenance: false + push: true + sbom: false + tags: ${{ steps.docker_meta.outputs.tags }} diff --git a/.github/workflows/trixie-msmtp.yml b/.github/workflows/trixie-msmtp.yml new file mode 100644 index 0000000..d9c7e83 --- /dev/null +++ b/.github/workflows/trixie-msmtp.yml @@ -0,0 +1,106 @@ +# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax +# https://docs.github.com/en/actions/reference/workflows-and-actions/variables +name: 'trixie-msmtp' +# GHCR: GitHub Container Registry + +on: + push: + branches: [main] + paths: + - '.github/workflows/trixie-msmtp.yml' + - '.github/workflows/prek_checks.yml' + - 'trixie-msmtp/' + - '!trixie-msmtp/README.md' + workflow_dispatch: + +env: + DESCRIPTION: 'Creative Commons (CC) Debian 13 (trixie) with msmtp' + OCI: 'org.opencontainers.image' + TITLE: 'CC Debian trixie with msmtp' + URL: 'https://github.com/creativecommons/containers/trixie-msmtp' + VENDOR: 'Creative Commons' + +jobs: + + prek_checks: + uses: $/.github/workflows/prek_checks.yml + + build_and_push: + needs: prek_checks + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + + steps: + + - parallel: + + # https://github.com/docker/login-action + - name: Docker login to GitHub Container Registry (GHCR) + # docker/login-action v4.8.0 + uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # https://github.com/docker/metadata-action + - name: Docker extract metadata + id: docker_meta + env: + DOCKER_METADATA_ANNOTATIONS_LEVELS: index + # docker/metadata-action v6.2.0 + uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 + with: + annotations: | + ${{ env.OCI }}.created={{ date 'YYYY-MM-DDTHH:mm:ss.SSS[Z]' }} + ${{ env.OCI }}.description=${{ env.DESCRIPTION }} + ${{ env.OCI }}.source=${{ env.URL }} + ${{ env.OCI }}.title=${{ env.TITLE }} + ${{ env.OCI }}.url=${{ env.URL }} + ${{ env.OCI }}.vendor=${{ env.VENDOR }} + images: ghcr.io/creativecommons/trixie-msmtp + # https://specs.opencontainers.org/image-spec/annotations/ + labels: | + ${{ env.OCI }}.created={{ date 'YYYY-MM-DDTHH:mm:ss.SSS[Z]' }} + ${{ env.OCI }}.description=${{ env.DESCRIPTION }} + ${{ env.OCI }}.source=${{ env.URL }} + ${{ env.OCI }}.title=${{ env.TITLE }} + ${{ env.OCI }}.url=${{ env.URL }} + ${{ env.OCI }}.vendor=${{ env.VENDOR }} + tags: | + type=raw,value={{date 'YYYYMMDD-HHmmss'}} + type=raw,priority=100,value=latest + + # https://github.com/docker/setup-buildx-action + - name: Docker setup Buildx + id: docker_buildx + # docker/setup-buildx-action v4.4.1 + uses: >- + docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 + with: + platforms: linux/amd64,linux/arm64 + + # https://github.com/actions/checkout + - name: GitHub checkout repository + # actions/checkout v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + + + # https://github.com/docker/build-push-action + - name: Build and push Docker image to GHCR + # build-push-action v7.4.0 + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc + with: + annotations: ${{ steps.docker_meta.outputs.annotations }} + builder: ${{ steps.docker_buildx.outputs.name }} + cache-from: type=gha + cache-to: type=gha,mode=max + context: trixie-msmtp + labels: ${{ steps.docker_meta.outputs.labels }} + platforms: ${{ steps.docker_buildx.outputs.platforms }} + provenance: false + push: true + sbom: false + tags: ${{ steps.docker_meta.outputs.tags }} diff --git a/.github/workflows/trixie.yml b/.github/workflows/trixie.yml index 06d35ca..a009140 100644 --- a/.github/workflows/trixie.yml +++ b/.github/workflows/trixie.yml @@ -14,7 +14,7 @@ on: workflow_dispatch: env: - DESCRIPTION: 'Creative Commons (CC) Debian 13 (trixie)' + DESCRIPTION: 'Creative Commons (CC) Debian 13 (trixie) with runit' OCI: 'org.opencontainers.image' TITLE: 'CC Debian trixie' URL: 'https://github.com/creativecommons/containers/trixie' @@ -89,7 +89,7 @@ jobs: # https://github.com/docker/build-push-action - - name: Build and push Docker trixie image to GHCR + - name: Build and push Docker image to GHCR # build-push-action v7.4.0 uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc with: diff --git a/.github/workflows/util-raw-dev.yml b/.github/workflows/util-raw-dev.yml index 779d4b0..58a3bde 100644 --- a/.github/workflows/util-raw-dev.yml +++ b/.github/workflows/util-raw-dev.yml @@ -5,7 +5,6 @@ name: 'util-raw-dev' on: pull_request: - branches-ignore: [main] paths: - '.github/workflows/util-raw-dev.yml' - '.github/workflows/prek_checks.yml' @@ -15,9 +14,9 @@ on: env: DESCRIPTION: >- - Simple utility that reports request headers received (development) + 'Simple utility that reports request headers received [development]' OCI: 'org.opencontainers.image' - TITLE: 'util-raw (development)' + TITLE: 'util-raw [development]' URL: 'https://github.com/creativecommons/containers/util-raw' VENDOR: 'Creative Commons' @@ -93,7 +92,7 @@ jobs: # https://github.com/docker/build-push-action - - name: Build and push Docker util-raw image to GHCR + - name: Build and push Docker image to GHCR # build-push-action v7.4.0 uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc with: diff --git a/.github/workflows/util-raw.yml b/.github/workflows/util-raw.yml index b8e1989..e78cdab 100644 --- a/.github/workflows/util-raw.yml +++ b/.github/workflows/util-raw.yml @@ -89,7 +89,7 @@ jobs: # https://github.com/docker/build-push-action - - name: Build and push Docker util-raw image to GHCR + - name: Build and push Docker image to GHCR # build-push-action v7.4.0 uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc with: diff --git a/docker-compose.yml b/docker-compose.yml index 9a7627b..d8e87ab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ name: cc services: - # Creative Commons Debian 13 (trixie) slim + # Creative Commons Debian 13 (trixie) with runit trixie: build: context: trixie @@ -14,16 +14,28 @@ services: entrypoint: /bin/true image: trixie + # Creative Commons Debian 13 (trixie) with msmtp + trixie-msmtp: + build: + additional_contexts: + 'ghcr.io/creativecommons/trixie:latest': 'service:trixie' + context: trixie-msmtp + # disable the entrypoint as the image is only being built locally for use + # by other services + entrypoint: /bin/true + image: trixie-msmtp + # Local development overlay trixie-local: build: additional_contexts: - trixie: "service:trixie" + trixie-msmtp: "service:trixie-msmtp" context: trixie-local command: sh -c 'echo "CMD ignored? (this should NOT show up in console)"' env_file: .env image: trixie-local + # HTTP header mirror utility util-raw: build: context: util-raw diff --git a/trixie-local/Dockerfile b/trixie-local/Dockerfile index 63f2263..29af13d 100644 --- a/trixie-local/Dockerfile +++ b/trixie-local/Dockerfile @@ -1,7 +1,7 @@ # https://docs.docker.com/engine/reference/builder/ # hadolint ignore=DL3006 -FROM trixie +FROM trixie-sys # https://docs.docker.com/build/building/best-practices/#apt-get # - apt and dpkg are configured in parent CC Debian trixie image diff --git a/trixie-msmtp/Dockerfile b/trixie-msmtp/Dockerfile new file mode 100644 index 0000000..4da75bb --- /dev/null +++ b/trixie-msmtp/Dockerfile @@ -0,0 +1,20 @@ +# https://docs.docker.com/engine/reference/builder/ + +# https://github.com/creativecommons/containers/pkgs/container/trixie +# hadolint ignore=DL3007 +FROM ghcr.io/creativecommons/trixie:latest + +# https://docs.docker.com/build/building/best-practices/#apt-get +# - apt and dpkg are configured in parent CC Debian trixie image +# - Retrieve new lists of packages, distribution upgrade, install new +# packages, erase downloaded archive files, and erase package lists +RUN set -o errexit -o nounset \ + && apt-get update --quiet \ + && apt-get dist-upgrade --quiet --yes \ + && apt-get install --quiet --yes \ + msmtp-mta \ + && apt-get clean --quiet \ + && rm --recursive --force /var/lib/apt/lists/* + +# msmtp configuration +COPY --parents conf.d/* /etc/container/ diff --git a/trixie-msmtp/README.md b/trixie-msmtp/README.md new file mode 100644 index 0000000..f74bd10 --- /dev/null +++ b/trixie-msmtp/README.md @@ -0,0 +1,82 @@ +# CC Debian trixie with msmtp + +Creative Commons (CC) Debian 13 (trixie) with msmtp Docker image + + +## Overview + +The goal of the CC Debian trixie with msmtp image is to provide a consistent +platform for application images. + +- **Docker `FROM` image:** + [`ghcr.io/creativecommons/trixie:latest`](../trixie/) +- **Docker `ENTRYPOINT`:** `["/usr/bin/dumb-init", "/etc/container/setup.sh"]` +- **Docker `CMD`:** _unset, ignored_ +- **Notable inclusions:** + 1. `msmtp` to allow sending emails +- **Required variables:** + - `MSMTP_FROM_EMAIL` + - `MSMTP_MAILNAME` + - `MSMTP_ROOT_EMAIL` + - `MSMTP_SERVER_HOST` + - `MSMTP_SERVER_PASSWORD` + - `MSMTP_SERVER_USER` + +> [!NOTE] +> `CMD` is ignored by this image. Instead service(s) must be installed and +> enabled per runit. + +[docker-trixie]: https://hub.docker.com/_/debian + + +## Configuration + +See [`../trixie/README.md`](../trixie/README.md). + + +### msmtp + +- [`conf.d/msmtp.sh`](conf.d/msmtp.sh) + + +### Services + +See [`../trixie/README.md`](../trixie/README.md). + + +## Deployment + +The image is deployed via GitHub Actions to the GitHub Container Registry +(GHCR). See the workflows for details: +- `main` branch: [`../.github/workflows/trixie-msmtp.yml`][build] +- all other branches: [`../.github/workflows/trixie-msmtp-dev.yml`][build-dev] + +[build]: ../.github/workflows/trixi-msmtp.yml +[build]: ../.github/workflows/trixie-msmtp-dev.yml + + +## Extending + +See [`../trixie/README.md`](../trixie/README.md). + + +### Application services + +See [`../trixie/README.md`](../trixie/README.md). + + +## Additional references + +See [`../trixie/README.md`](../trixie/README.md). + + +### msmtp + +- [msmtp - about][msmtp] + - [msmtp manual in HTML format][msmtp-man] +- [msmtp(1) — msmtp — Debian trixie — Debian Manpages][msmtp-debman] + + +[msmtp]: https://marlam.de/msmtp/ +[msmtp-man]: https://marlam.de/msmtp/msmtp.html +[msmtp-debman]: https://manpages.debian.org/trixie/msmtp/msmtp.1.en.html diff --git a/trixie/conf.d/msmtp.sh b/trixie-msmtp/conf.d/msmtp.sh similarity index 100% rename from trixie/conf.d/msmtp.sh rename to trixie-msmtp/conf.d/msmtp.sh diff --git a/trixie/Dockerfile b/trixie/Dockerfile index cbcb7c0..564b2cd 100644 --- a/trixie/Dockerfile +++ b/trixie/Dockerfile @@ -25,7 +25,6 @@ RUN set -o errexit -o nounset \ && apt-get install --quiet --yes \ dumb-init \ ca-certificates \ - msmtp-mta \ runit \ socklog-run \ && apt-get clean --quiet \ @@ -41,7 +40,7 @@ RUN set -o errexit -o nounset \ && update-service --add socklog-unix \ && update-service --add default-syslog \ && update-service --remove default-syslog -COPY --parents conf.d/* color_vars.sh /etc/container/ +COPY color_vars.sh /etc/container/ COPY --chmod=0555 setup.sh /etc/container/ # Initialization diff --git a/trixie/README.md b/trixie/README.md index 9c5a7ee..a7b7921 100644 --- a/trixie/README.md +++ b/trixie/README.md @@ -1,11 +1,11 @@ # CC Debian trixie -Creative Commons (CC) Debian 13 (trixie) Docker base image +Creative Commons (CC) Debian 13 (trixie) with runit Docker image. ## Overview -The goal of the CC Debian trixie base image is to provide a consistent platform +The goal of the CC Debian trixie image is to provide a consistent platform for application images. - **Docker `FROM` image:** [`debian:trixie-slim`][docker-trixie] @@ -15,14 +15,8 @@ for application images. 1. `dumb-init` to manage processes (init, PID 1) 2. `runit` to manage services 3. `socklog` to send syslog messages to init stdout (docker log) - 4. `msmtp` to allow sending emails - **Required variables:** - - `MSMTP_FROM_EMAIL` - - `MSMTP_MAILNAME` - - `MSMTP_ROOT_EMAIL` - - `MSMTP_SERVER_HOST` - - `MSMTP_SERVER_PASSWORD` - - `MSMTP_SERVER_USER` + - _none_ > [!NOTE] > `CMD` is ignored by this image. Instead service(s) must be installed and @@ -104,15 +98,3 @@ Runit service related documentation: [docker-trixie]: https://hub.docker.com/_/debian [trixie-release]: https://www.debian.org/releases/trixie/release-notes/index.en.html - - -### msmtp - -- [msmtp - about][msmtp] - - [msmtp manual in HTML format][msmtp-man] -- [msmtp(1) — msmtp — Debian trixie — Debian Manpages][msmtp-debman] - - -[msmtp]: https://marlam.de/msmtp/ -[msmtp-man]: https://marlam.de/msmtp/msmtp.html -[msmtp-debman]: https://manpages.debian.org/trixie/msmtp/msmtp.1.en.html