Use base image when building core images
parent
5e552bae69
commit
9fe452e3d1
@ -1,36 +1,22 @@
|
|||||||
ARG DISTRO=alpine:3.14.5
|
# syntax=docker/dockerfile-upstream:1.4.3
|
||||||
|
|
||||||
|
FROM base
|
||||||
|
|
||||||
FROM $DISTRO
|
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
ENV TZ Etc/UTC
|
|
||||||
|
|
||||||
LABEL version=$VERSION
|
LABEL version=$VERSION
|
||||||
|
|
||||||
# python3 shared with most images
|
RUN set -euxo pipefail \
|
||||||
RUN apk add --no-cache \
|
&& apk add --no-cache dovecot dovecot-lmtpd dovecot-pop3d dovecot-submissiond dovecot-pigeonhole-plugin rspamd-client xapian-core dovecot-fts-xapian \
|
||||||
python3 py3-pip git bash py3-multidict py3-yarl tzdata \
|
&& mkdir /var/lib/dovecot
|
||||||
&& pip3 install --upgrade pip
|
|
||||||
|
|
||||||
# Shared layer between nginx, dovecot, postfix, postgresql, rspamd, unbound, snappymail, roundcube
|
|
||||||
RUN pip3 install socrate==0.2.0
|
|
||||||
|
|
||||||
# Shared layer between dovecot and postfix
|
|
||||||
RUN apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev \
|
|
||||||
&& pip3 install "podop>0.2.5" \
|
|
||||||
&& apk del .build-deps
|
|
||||||
|
|
||||||
# Image specific layers under this line
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
dovecot dovecot-lmtpd dovecot-pop3d dovecot-submissiond dovecot-pigeonhole-plugin rspamd-client xapian-core dovecot-fts-xapian \
|
|
||||||
&& mkdir /var/lib/dovecot
|
|
||||||
|
|
||||||
COPY conf /conf
|
COPY conf /conf
|
||||||
COPY start.py /start.py
|
COPY start.py /start.py
|
||||||
|
|
||||||
|
RUN echo $VERSION >> /version
|
||||||
|
|
||||||
EXPOSE 110/tcp 143/tcp 993/tcp 4190/tcp 2525/tcp
|
EXPOSE 110/tcp 143/tcp 993/tcp 4190/tcp 2525/tcp
|
||||||
|
HEALTHCHECK --start-period=350s CMD echo QUIT|nc localhost 110|grep "Dovecot ready."
|
||||||
|
|
||||||
VOLUME ["/mail"]
|
VOLUME ["/mail"]
|
||||||
|
|
||||||
CMD /start.py
|
CMD /start.py
|
||||||
|
|
||||||
HEALTHCHECK --start-period=350s CMD echo QUIT|nc localhost 110|grep "Dovecot ready."
|
|
||||||
RUN echo $VERSION >> /version
|
|
@ -1,34 +1,33 @@
|
|||||||
ARG DISTRO=alpine:3.14.5
|
# syntax=docker/dockerfile-upstream:1.4.3
|
||||||
FROM $DISTRO
|
|
||||||
|
FROM base as static
|
||||||
|
|
||||||
|
COPY static /static
|
||||||
|
|
||||||
|
RUN set -euxo pipefail \
|
||||||
|
&& gzip -k9 /static/*.ico /static/*.txt \
|
||||||
|
&& chmod a+rX-w -R /static
|
||||||
|
|
||||||
|
|
||||||
|
FROM base
|
||||||
|
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
|
|
||||||
ENV TZ Etc/UTC
|
|
||||||
|
|
||||||
LABEL version=$VERSION
|
LABEL version=$VERSION
|
||||||
|
|
||||||
# python3 shared with most images
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
python3 py3-pip git bash py3-multidict \
|
|
||||||
&& pip3 install --upgrade pip
|
|
||||||
|
|
||||||
# Shared layer between nginx, dovecot, postfix, postgresql, rspamd, unbound, snappymail, roundcube
|
|
||||||
RUN pip3 install socrate==0.2.0
|
|
||||||
|
|
||||||
# Image specific layers under this line
|
# Image specific layers under this line
|
||||||
RUN apk add --no-cache certbot nginx nginx-mod-mail openssl curl tzdata \
|
RUN set -euxo pipefail \
|
||||||
&& pip3 install watchdog
|
&& apk add --no-cache certbot nginx nginx-mod-mail openssl curl \
|
||||||
|
&& pip3 install --no-cache-dir watchdog
|
||||||
|
|
||||||
COPY conf /conf
|
COPY conf /conf
|
||||||
COPY static /static
|
COPY --from=static /static /static
|
||||||
COPY *.py /
|
COPY *.py /
|
||||||
|
|
||||||
RUN gzip -k9 /static/*.ico /static/*.txt; chmod a+rX -R /static
|
RUN echo $VERSION >> /version
|
||||||
|
|
||||||
EXPOSE 80/tcp 443/tcp 110/tcp 143/tcp 465/tcp 587/tcp 993/tcp 995/tcp 25/tcp 10025/tcp 10143/tcp
|
EXPOSE 80/tcp 443/tcp 110/tcp 143/tcp 465/tcp 587/tcp 993/tcp 995/tcp 25/tcp 10025/tcp 10143/tcp
|
||||||
VOLUME ["/certs"]
|
HEALTHCHECK --start-period=60s CMD curl -skfLo /dev/null http://localhost/health
|
||||||
VOLUME ["/overrides"]
|
|
||||||
|
VOLUME ["/certs", "/overrides"]
|
||||||
|
|
||||||
CMD /start.py
|
CMD /start.py
|
||||||
|
|
||||||
HEALTHCHECK CMD curl -k -f -L http://localhost/health || exit 1
|
|
||||||
RUN echo $VERSION >> /version
|
|
@ -1,6 +1,14 @@
|
|||||||
|
# syntax=docker/dockerfile-upstream:1.4.3
|
||||||
# This is an idle image to dynamically replace any component if disabled.
|
# This is an idle image to dynamically replace any component if disabled.
|
||||||
|
|
||||||
ARG DISTRO=alpine:3.14.5
|
FROM base
|
||||||
FROM $DISTRO
|
|
||||||
|
|
||||||
CMD sleep 1000000d
|
ARG VERSION=local
|
||||||
|
LABEL version=$VERSION
|
||||||
|
|
||||||
|
RUN echo $VERSION >> /version
|
||||||
|
|
||||||
|
HEALTHCHECK CMD true
|
||||||
|
|
||||||
|
USER app
|
||||||
|
CMD ["/bin/bash", "-c", "sleep infinity"]
|
||||||
|
@ -1,31 +1,22 @@
|
|||||||
ARG DISTRO=alpine:3.15
|
# syntax=docker/dockerfile-upstream:1.4.3
|
||||||
FROM $DISTRO
|
|
||||||
ARG VERSION
|
|
||||||
ENV TZ Etc/UTC
|
|
||||||
|
|
||||||
|
FROM base
|
||||||
|
|
||||||
|
ARG VERSION=local
|
||||||
LABEL version=$VERSION
|
LABEL version=$VERSION
|
||||||
|
|
||||||
# python3 shared with most images
|
RUN set -euxo pipefail \
|
||||||
RUN apk add --no-cache \
|
&& apk add --no-cache rspamd rspamd-controller rspamd-proxy rspamd-fuzzy ca-certificates curl \
|
||||||
python3 py3-pip git bash py3-multidict tzdata \
|
&& mkdir /run/rspamd
|
||||||
&& pip3 install --upgrade pip
|
|
||||||
|
|
||||||
# Shared layer between nginx, dovecot, postfix, postgresql, rspamd, unbound, snappymail, roundcube
|
|
||||||
RUN pip3 install socrate==0.2.0
|
|
||||||
|
|
||||||
# Image specific layers under this line
|
|
||||||
RUN apk add --no-cache rspamd rspamd-controller rspamd-proxy rspamd-fuzzy ca-certificates curl
|
|
||||||
|
|
||||||
RUN mkdir /run/rspamd
|
|
||||||
|
|
||||||
COPY conf/ /conf
|
COPY conf/ /conf
|
||||||
COPY start.py /start.py
|
COPY start.py /start.py
|
||||||
|
|
||||||
|
RUN echo $VERSION >> /version
|
||||||
|
|
||||||
EXPOSE 11332/tcp 11334/tcp 11335/tcp
|
EXPOSE 11332/tcp 11334/tcp 11335/tcp
|
||||||
|
HEALTHCHECK --start-period=350s CMD curl -skfLo /dev/null http://localhost:11334/
|
||||||
|
|
||||||
VOLUME ["/var/lib/rspamd"]
|
VOLUME ["/var/lib/rspamd"]
|
||||||
|
|
||||||
CMD /start.py
|
CMD /start.py
|
||||||
|
|
||||||
HEALTHCHECK --start-period=350s CMD curl -f -L http://localhost:11334/ || exit 1
|
|
||||||
RUN echo $VERSION >> /version
|
|
Loading…
Reference in New Issue