From 631cb25eff673ebf472a338a9e95f6267eb0040f Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Fri, 18 Feb 2022 09:35:14 +0100 Subject: [PATCH] use new s6-rc layout [skip CI] --- .editorconfig | 9 -------- .gitlab-ci.yml | 21 ++++++++++++------- Dockerfile | 16 -------------- README.md | 4 ++++ rootfs/bin/aliases | 4 ++++ rootfs/etc/cont-init.d/00-aliases | 5 ----- rootfs/etc/s6-overlay/s6-rc.d/aliases/type | 1 + rootfs/etc/s6-overlay/s6-rc.d/aliases/up | 1 + .../s6-overlay/s6-rc.d/postfix/dependencies | 2 ++ .../s6-rc.d}/postfix/run | 2 +- rootfs/etc/s6-overlay/s6-rc.d/postfix/type | 1 + .../s6-rc.d/user/contents.d/postfix | 0 12 files changed, 27 insertions(+), 39 deletions(-) delete mode 100644 .editorconfig create mode 100755 rootfs/bin/aliases delete mode 100644 rootfs/etc/cont-init.d/00-aliases create mode 100644 rootfs/etc/s6-overlay/s6-rc.d/aliases/type create mode 100644 rootfs/etc/s6-overlay/s6-rc.d/aliases/up create mode 100644 rootfs/etc/s6-overlay/s6-rc.d/postfix/dependencies rename rootfs/etc/{services.d => s6-overlay/s6-rc.d}/postfix/run (82%) create mode 100644 rootfs/etc/s6-overlay/s6-rc.d/postfix/type create mode 100644 rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/postfix diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index d741e40..0000000 --- a/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = space -indent_size = 4 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 403f666..f6d2976 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,18 @@ variables: - IMAGE_NAME: thallian/postfix-ldap + CONTAINER_NAME: thallian/postfix build: stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] script: - - docker login -u $DOCKER_USER -p $DOCKER_PASSWORD $DOCKER_REGISTRY - - docker build -t $IMAGE_NAME:$CI_COMMIT_SHA . - - docker build -t $IMAGE_NAME:$CI_COMMIT_REF_NAME . - - docker build -t $IMAGE_NAME:latest . - - docker push $IMAGE_NAME:$CI_COMMIT_SHA - - docker push $IMAGE_NAME:$CI_COMMIT_REF_NAME - - docker push $IMAGE_NAME:latest + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "$CI_REGISTRY_USER" "$CI_REGISTRY_PASSWORD" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json + - >- + /kaniko/executor + --context "$CI_PROJECT_DIR" + --dockerfile "$CI_PROJECT_DIR/Dockerfile" + --destination "$CONTAINER_NAME:$CI_COMMIT_SHA" + --destination "$CONTAINER_NAME:$CI_COMMIT_REF_NAME" + --destination "$CONTAINER_NAME:latest" diff --git a/Dockerfile b/Dockerfile index 581ca98..093269a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,5 @@ -FROM alpine:3.14 as builder - -RUN apk add --no-cache \ - g++ \ - make \ - libmilter-dev \ - spamassassin-client - -RUN mkdir /tmp/spamass-milter -RUN wget -qO- https://download.savannah.gnu.org/releases/spamass-milt/spamass-milter-0.4.0.tar.gz | tar -xz -C /tmp/spamass-milter --strip 1 -WORKDIR /tmp/spamass-milter - -RUN ./configure && make - FROM thallian/confd-env:latest -COPY --from=builder /tmp/spamass-milter/spamass-milter /bin/spamass-milter - RUN apk add --no-cache \ postfix \ postfix-pgsql \ diff --git a/README.md b/README.md index 33f2661..7ae5c91 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ create table if not exists virtual_aliases ( source text not null, destination text not null ); + +create table if not exists virtual_senders ( + email text not null references virtual_users(email) +); ``` # Volumes diff --git a/rootfs/bin/aliases b/rootfs/bin/aliases new file mode 100755 index 0000000..ad02447 --- /dev/null +++ b/rootfs/bin/aliases @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +newaliases diff --git a/rootfs/etc/cont-init.d/00-aliases b/rootfs/etc/cont-init.d/00-aliases deleted file mode 100644 index 0e9e722..0000000 --- a/rootfs/etc/cont-init.d/00-aliases +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv sh -set -e - -newaliases - diff --git a/rootfs/etc/s6-overlay/s6-rc.d/aliases/type b/rootfs/etc/s6-overlay/s6-rc.d/aliases/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/aliases/type @@ -0,0 +1 @@ +oneshot diff --git a/rootfs/etc/s6-overlay/s6-rc.d/aliases/up b/rootfs/etc/s6-overlay/s6-rc.d/aliases/up new file mode 100644 index 0000000..0427d87 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/aliases/up @@ -0,0 +1 @@ +aliases diff --git a/rootfs/etc/s6-overlay/s6-rc.d/postfix/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/postfix/dependencies new file mode 100644 index 0000000..b07c0e6 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/postfix/dependencies @@ -0,0 +1,2 @@ +confd +aliases diff --git a/rootfs/etc/services.d/postfix/run b/rootfs/etc/s6-overlay/s6-rc.d/postfix/run similarity index 82% rename from rootfs/etc/services.d/postfix/run rename to rootfs/etc/s6-overlay/s6-rc.d/postfix/run index 9968ec2..1d3e9b9 100644 --- a/rootfs/etc/services.d/postfix/run +++ b/rootfs/etc/s6-overlay/s6-rc.d/postfix/run @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv sh +#!/bin/sh mkdir -p /var/spool/postfix/etc cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf diff --git a/rootfs/etc/s6-overlay/s6-rc.d/postfix/type b/rootfs/etc/s6-overlay/s6-rc.d/postfix/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/postfix/type @@ -0,0 +1 @@ +longrun diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/postfix b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/postfix new file mode 100644 index 0000000..e69de29