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
|
||||
ENV TZ Etc/UTC
|
||||
|
||||
LABEL version=$VERSION
|
||||
|
||||
# python3 shared with most images
|
||||
RUN apk add --no-cache \
|
||||
python3 py3-pip git bash py3-multidict py3-yarl tzdata \
|
||||
&& 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
|
||||
RUN set -euxo pipefail \
|
||||
&& 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 start.py /start.py
|
||||
|
||||
RUN echo $VERSION >> /version
|
||||
|
||||
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"]
|
||||
|
||||
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
|
||||
FROM $DISTRO
|
||||
# syntax=docker/dockerfile-upstream:1.4.3
|
||||
|
||||
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
|
||||
|
||||
ENV TZ Etc/UTC
|
||||
|
||||
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
|
||||
RUN apk add --no-cache certbot nginx nginx-mod-mail openssl curl tzdata \
|
||||
&& pip3 install watchdog
|
||||
RUN set -euxo pipefail \
|
||||
&& apk add --no-cache certbot nginx nginx-mod-mail openssl curl \
|
||||
&& pip3 install --no-cache-dir watchdog
|
||||
|
||||
COPY conf /conf
|
||||
COPY static /static
|
||||
COPY --from=static /static /static
|
||||
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
|
||||
VOLUME ["/certs"]
|
||||
VOLUME ["/overrides"]
|
||||
HEALTHCHECK --start-period=60s CMD curl -skfLo /dev/null http://localhost/health
|
||||
|
||||
VOLUME ["/certs", "/overrides"]
|
||||
|
||||
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.
|
||||
|
||||
ARG DISTRO=alpine:3.14.5
|
||||
FROM $DISTRO
|
||||
FROM base
|
||||
|
||||
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
|
||||
FROM $DISTRO
|
||||
ARG VERSION
|
||||
ENV TZ Etc/UTC
|
||||
# syntax=docker/dockerfile-upstream:1.4.3
|
||||
|
||||
FROM base
|
||||
|
||||
ARG VERSION=local
|
||||
LABEL version=$VERSION
|
||||
|
||||
# python3 shared with most images
|
||||
RUN apk add --no-cache \
|
||||
python3 py3-pip git bash py3-multidict tzdata \
|
||||
&& 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
|
||||
RUN set -euxo pipefail \
|
||||
&& apk add --no-cache rspamd rspamd-controller rspamd-proxy rspamd-fuzzy ca-certificates curl \
|
||||
&& mkdir /run/rspamd
|
||||
|
||||
COPY conf/ /conf
|
||||
COPY start.py /start.py
|
||||
|
||||
RUN echo $VERSION >> /version
|
||||
|
||||
EXPOSE 11332/tcp 11334/tcp 11335/tcp
|
||||
HEALTHCHECK --start-period=350s CMD curl -skfLo /dev/null http://localhost:11334/
|
||||
|
||||
VOLUME ["/var/lib/rspamd"]
|
||||
|
||||
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