Skip to content

Commit

Permalink
Merge pull request huan#43 from riptidewave93/refactor-base
Browse files Browse the repository at this point in the history
Update Base to Alpine 3.8
  • Loading branch information
huan authored Oct 23, 2018
2 parents 0214118 + 3fbe262 commit b136a04
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
20 changes: 15 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
FROM sillelien/base-alpine:0.10
FROM alpine:3.8
LABEL maintainer="Zhuohuan LI <zixia@zixia.net>"

ENV BATS_VERSION 0.4.0
ENV BATS_VERSION 1.1.0
ENV S6_VERSION 1.21.7.0

## Install System

RUN apk add --update --no-cache \
bash \
curl \
cyrus-sasl \
drill \
logrotate \
openssl \
postfix \
cyrus-sasl \
syslog-ng \
\
&& curl -s -o "/tmp/v${BATS_VERSION}.tar.gz" -L \
"https://github.com/sstephenson/bats/archive/v${BATS_VERSION}.tar.gz" \
"https://github.com/bats-core/bats-core/archive/v${BATS_VERSION}.tar.gz" \
&& tar -xzf "/tmp/v${BATS_VERSION}.tar.gz" -C /tmp/ \
&& bash "/tmp/bats-${BATS_VERSION}/install.sh" /usr/local \
&& bash "/tmp/bats-core-${BATS_VERSION}/install.sh" /usr/local \
\
&& rm -rf /tmp/*

## Install s6 process manager
RUN curl -L -s https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-amd64.tar.gz \
| tar xzf - -C /

## Configure Service

COPY install/main.dist.cf /etc/postfix/main.cf
COPY install/master.dist.cf /etc/postfix/master.cf
COPY install/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf

RUN cat /dev/null > /etc/postfix/aliases && newaliases \
&& echo simple-mail-forwarder.com > /etc/hostname \
Expand All @@ -43,6 +50,9 @@ RUN bash -n /app/init-openssl.sh && chmod +x /app/init-openssl.sh
COPY install/postfix.sh /etc/services.d/postfix/run
RUN bash -n /etc/services.d/postfix/run && chmod +x /etc/services.d/postfix/run

COPY install/syslog-ng.sh /etc/services.d/syslog-ng/run
RUN bash -n /etc/services.d/syslog-ng/run && chmod +x /etc/services.d/syslog-ng/run

COPY entrypoint.sh /entrypoint.sh
RUN bash -n /entrypoint.sh && chmod a+x /entrypoint.sh

Expand Down
2 changes: 0 additions & 2 deletions install/postfix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ daemon_directory=`$command_directory/postconf -h daemon_directory`
$daemon_directory/master -t || $command_directory/postfix stop

# make consistency check
chown root /var/spool/postfix
chown root /var/spool/postfix/pid
$command_directory/postfix check >/dev/console 2>&1

# run Postfix
Expand Down
43 changes: 43 additions & 0 deletions install/syslog-ng.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@version: 3.9

# Options
options {
# Disable statistic log messages.
stats_freq(0);
};

# Sources
source s_dgram {
unix-dgram("/dev/log");
internal();
};

# Filters
filter f_out {
level(info..warn);
};
filter f_err {
level(err..emerg,debug);
};

# Destinations
destination d_stdout {
pipe("/dev/stdout");
};

destination d_stderr {
pipe("/dev/stderr");
};

# Logs
log {
source(s_dgram);
filter(f_out);
destination(d_stdout);
};

log {
source(s_dgram);
filter(f_err);
destination(d_stderr);
};
3 changes: 3 additions & 0 deletions install/syslog-ng.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/execlineb -P

/usr/sbin/syslog-ng --cfgfile=/etc/syslog-ng/syslog-ng.conf -F

0 comments on commit b136a04

Please sign in to comment.