diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 47bee87..8c450d2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,18 +7,15 @@ stages: variables: VERSION: latest CACHETAG: build - DOCKER_REGISTRY: registry.leenooks.net - DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375 + DOCKER_HOST: tcp://${CI_REGISTRY}-leenooks-ci-docker:2375 services: -- ${DOCKER_REGISTRY}/leenooks/ci-docker:dind +- ${CI_REGISTRY}/leenooks/ci-docker:dind before_script: - docker info - docker version -- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY} -- echo "CI_PROJECT_PATH ${CI_PROJECT_PATH} CI_COMMIT_TAG ${CI_COMMIT_TAG} CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME}" -- echo "CI_REGISTRY ${CI_REGISTRY} CI_REGISTRY_IMAGE ${CI_REGISTRY_IMAGE} CI ${CI}" +- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin test: stage: test @@ -33,7 +30,7 @@ test: build: stage: build script: - - chmod 500 init + - [ -f init ] && chmod 500 init - docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG} || true - docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} . - docker push ${CI_REGISTRY_IMAGE}:${VERSION} diff --git a/Dockerfile b/Dockerfile index 3757089..bab0130 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,11 @@ # NAME leenooks/smtp # VERSION latest -# BUILD docker build -t="leenooks/smtp" . -FROM registry.leenooks.net/leenooks/base:7.E +FROM debian:stretch -# EPEL & Leenooks packages -RUN yum -y install \ - make \ - m4 \ - sendmail \ - sendmail-cf \ - ln-mail-server \ - milter-greylist \ - && yum clean all +RUN apt-get update \ + && apt-get install sendmail sasl2-bin milter-greylist -yyq \ + && rm -rf /var/lib/apt/lists/* /tmp/* RUN useradd -rc "HUB Mail Relay" -M relay -NG mail -s /sbin/nologin && echo relay:SmTpR3l@Y | chpasswd diff --git a/init b/init index 53d0976..575bd0c 100755 --- a/init +++ b/init @@ -5,7 +5,8 @@ NAME="SMTP" function stop { echo "Stopping ${NAME}" - kill $(cat /var/run/sendmail.pid|head -1) + kill $(cat /run/saslauthd/saslauthd.pid) + kill $(cat /run/sendmail/mta/sendmail.pid|head -1) } trap 'stop' SIGTERM @@ -17,7 +18,7 @@ fi if [ "$1" == "start" ]; then /usr/sbin/saslauthd -m /run/saslauthd -a pam - cd /etc/mail && rm -f *.db && make && m4 sendmail.mc > sendmail.cf && /usr/sbin/sendmail -q1h -bD & + cd /etc/mail && make && make && exec /usr/sbin/sendmail -q1h -bD & wait else