Initial release

This commit is contained in:
Deon George 2017-07-23 19:36:36 +10:00
commit aaec9fefa5
3 changed files with 90 additions and 0 deletions

46
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,46 @@
image: docker:latest
stages:
- test
- build
variables:
VERSION: latest
AUTO_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}"
- echo "AUTO_VERSION ${AUTO_VERSION}"
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

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
# NAME leenooks/rspamd
# VERSION latest
# BUILD docker build -t="leenooks/rspamd" .
# START docker run -d ...
# CRON docker exec -it rspamd ...
FROM registry.leenooks.net/leenooks/base:7.E
RUN yum -y install wget && yum clean all && wget -O /etc/yum.repos.d/rspamd.repo http://rspamd.com/rpm-stable/centos-7/rspamd.repo && rpm --import http://rspamd.com/rpm-stable/gpg.key
# EPEL & Leenooks packages
RUN yum -y install \
rmilter \
rspamd \
&& yum clean all
EXPOSE 11332 11333 11334
COPY init /sbin/
# Starting
ENTRYPOINT [ "/sbin/init" ]
CMD [ "start" ]

21
init Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
NAME="RSPAMD"
function stop {
echo "Stopping ${NAME}"
kill $(cat /var/run/rspamd.pid)
kill $(cat /var/run/rmilter.pid)
}
trap 'stop' SIGTERM
if [ "$1" == "start" ]; then
[ -x /usr/bin/rspamd ] && /usr/bin/rspamd -u _rspamd -g _rspamd -c /etc/rspamd/rspamd.conf -f -p /var/run/rspamd.pid &
[ -x /usr/sbin/rmilter ] && /usr/sbin/rmilter -n -c /etc/rmilter/rmilter.conf &
wait
else
exec $@
fi