add tasks and correct dockerfile to alpine
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Memiks 2019-12-08 03:23:31 +09:00
parent 85fdb56e87
commit 6efe643f85
3 changed files with 94 additions and 22 deletions

View File

@ -5,4 +5,4 @@ name: exec-debian-memiks
steps:
- name: docker build
commands:
- docker build -t 'opensmtpd-debian' .
- docker build -t 'opensmtpd-alpine' .

36
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,36 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "docker build",
"type": "shell",
"command": "docker build -t ${workspaceFolderBasename} . ",
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "into docker image",
"type": "shell",
"windows":{"command": "c:/Program Files/Docker/Docker/Resources/bin/docker"},
"args": [
"run",
"--rm",
"-it",
"${input:dockerID}",
"bash"
]
}
],
"inputs": [
{
"id":"dockerID",
"description": "docker id to deep into",
"default": "ex: b950ac16e056",
"type": "promptString"
}
]
}

View File

@ -1,24 +1,44 @@
FROM debian
FROM alpine
LABEL Maintainer="Memiks <contact@memiks.fr>" \
Description="Lightweight container with OpenSMTPD on Debian Linux."
Description="Lightweight container with OpenSMTPD on Alpine Linux."
# Install packages
RUN apt -qy update
# Allow container to expose ports at runtime, if necessary
# https://docs.docker.com/engine/reference/#expose
EXPOSE 25
EXPOSE 465
EXPOSE 587
RUN apt-get install -qy \
build-essential linux-libc-dev \
autoconf automake autoconf bison libevent-dev libasr-dev cmake libtool pkg-config \
git curl gawk tar bzip2 ncompress xz-utils tree wget
WORKDIR /tmp
ENV LIBRESSLVERSION=libressl-3.0.2
RUN wget -O ${LIBRESSLVERSION}.tar.gz https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/${LIBRESSLVERSION}.tar.gz
RUN tar xf ${LIBRESSLVERSION}.tar.gz
WORKDIR /tmp/${LIBRESSLVERSION}
RUN ./configure --prefix=/usr/local/libressl --with-openssldir=/usr/local/libressl
RUN make && make install
# install necessary packages
RUN apk add --no-cache \
autoconf \
automake \
bison \
ca-certificates \
fts-dev \
gcc \
fts \
libasr-dev \
libevent-dev \
libtool \
libtool \
linux-pam-dev \
make \
musl-dev \
openssl \
openssl-dev \
zlib-dev \
git
# create users and directories
# note: alpine uses busybox and useradd is not available there
# also long flags are not available too, so sorry for the
RUN mkdir -p /var/lib/opensmtpd/empty \
&& adduser _smtpd -h /var/lib/opensmtpd/empty/ -D -H -s /bin/false \
&& adduser _smtpq -h /var/lib/opensmtpd/empty/ -D -H -s /bin/false \
&& mkdir -p /var/spool/smtpd \
&& mkdir -p /var/mail \
&& mkdir -p /etc/mail \
&& chmod 711 /var/spool/smtpd
WORKDIR /tmp
RUN git clone -b portable git://github.com/OpenSMTPD/OpenSMTPD.git opensmtpd
@ -26,11 +46,27 @@ RUN git clone -b portable git://github.com/OpenSMTPD/OpenSMTPD.git opensmtpd
WORKDIR /tmp/opensmtpd
RUN ./bootstrap \
&& ./configure \
--with-libssl=/usr/local/libressl
--prefix=/usr \
--sbindir=/usr/bin \
--libexecdir=/usr/lib/smtpd \
--sysconfdir=/etc/smtpd \
--with-user-smtpd=smtpd \
--with-user-queue=smtpq \
--with-group-queue=smtpq \
--with-gnu-ld \
--with-auth-pam
RUN make && make install
#RUN etc/aliases /etc/mail/aliases
RUN addgroup smtpq
RUN adduser -D -S -G smtpq smtpq
RUN addgroup smtpd
RUN adduser -D -S -G smtpd smtpd
USER smtpd
WORKDIR /etc/smtpd
# Override shell for bash-y debugging goodness
SHELL ["/bin/bash", "-exc"]
WORKDIR /tmp