commit 1df811cc62c388cb9c6f90f06e16603f1686d02a Author: Andrey Arapov Date: Mon Dec 17 16:59:30 2018 +0100 first commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7129a21 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM alpine:3.8 +MAINTAINER Andrey Arapov + +RUN apk update && \ + apk upgrade && \ + apk add dovecot runit socklog && \ + rm -rf /etc/service + +COPY service /etc/service/ +# RUN find /etc/service -xdev -type f -name "run" -exec chmod +x '{}' \; +ENTRYPOINT runsvdir -P /etc/service diff --git a/service/dovecot/finish b/service/dovecot/finish new file mode 100755 index 0000000..6a83bc5 --- /dev/null +++ b/service/dovecot/finish @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "${PWD##*/}: Exitted with $1 (signal: $2)" +[ $1 -ne 0 ] && ( echo "${PWD##*/}: rc != 0, sleeping for 5 seconds ..."; sleep 5 ) diff --git a/service/dovecot/run b/service/dovecot/run new file mode 100755 index 0000000..f56bf7a --- /dev/null +++ b/service/dovecot/run @@ -0,0 +1,8 @@ +#!/bin/sh +exec 2>&1 + +echo "${PWD##*/}: started." + +set -x +chown -Rh dovecot:dovecot -- /etc/dovecot +exec /usr/sbin/dovecot -F diff --git a/service/logger/finish b/service/logger/finish new file mode 100755 index 0000000..6a83bc5 --- /dev/null +++ b/service/logger/finish @@ -0,0 +1,4 @@ +#!/bin/sh + +echo "${PWD##*/}: Exitted with $1 (signal: $2)" +[ $1 -ne 0 ] && ( echo "${PWD##*/}: rc != 0, sleeping for 5 seconds ..."; sleep 5 ) diff --git a/service/logger/run b/service/logger/run new file mode 100755 index 0000000..202f60a --- /dev/null +++ b/service/logger/run @@ -0,0 +1,10 @@ +#!/bin/sh +# Collect all logs which come to /dev/log +exec 2>&1 + +echo "${PWD##*/}: started." + +set -x +exec chpst -Unobody socklog unix /dev/log +# exec socklog unix /dev/log +# exec socat UNIX-LISTEN:/dev/log,reuseaddr,fork - diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..3bdf78a --- /dev/null +++ b/start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +IMAGE=dovecot + +docker build -t $IMAGE . +docker rm -f $IMAGE +docker run -d \ + -h $(hostname -f) \ + --name $IMAGE \ + -v /etc/localtime:/etc/localtime:ro \ + $IMAGE