Initial release

This commit is contained in:
Deon George 2017-07-23 17:56:38 +10:00
commit f76b0306c7
3 changed files with 98 additions and 0 deletions

44
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,44 @@
image: docker:latest
stages:
- test
- build
variables:
VERSION: ${CI_COMMIT_TAG:-latest}
CACHETAG: build
DOCKER_REGISTRY: registry.leenooks.net
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
services:
- ${DOCKER_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}"
test:
stage: test
script:
- cat /etc/hosts
- env|sort
- docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} .
- docker images
only:
- debug
build:
stage: build
script:
- 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}
- docker push ${CI_REGISTRY_IMAGE}:${CACHETAG}
tags:
- docker
only:
- master

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
# NAME leenooks/smtp
# VERSION latest
# BUILD docker build -t="leenooks/smtp" .
FROM registry.leenooks.net/leenooks/base:7
RUN yum -y install epel-release && yum clean all
# EPEL & Leenooks packages
RUN yum -y install \
make \
m4 \
sendmail \
sendmail-cf \
ln-mail-server \
milter-greylist \
&& yum clean all
# ln-mail-client \
RUN useradd -rc "HUB Mail Relay" -M relay -NG mail -s /sbin/nologin -p SmTpR3l@Y
EXPOSE 25
COPY init /sbin/
# Starting
ENTRYPOINT [ "/sbin/init" ]
CMD [ "start" ]

25
init Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
set -e
NAME="SMTP"
function stop {
echo "Stopping ${NAME}"
kill $(cat /var/run/sendmail.pid|head -1)
}
trap 'stop' SIGTERM
if [ -z `hostname --domain` ]; then
echo "You must start this container with --hostname= specifying a domain name"
exit 1
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 &
wait
else
exec $@
fi