59 lines
1.4 KiB
Docker
59 lines
1.4 KiB
Docker
FROM docker.io/library/alpine:3.24
|
|
|
|
# Variables for Labels
|
|
ARG VENDOR="k2patel"
|
|
ARG COMPONENT="postfix-relay"
|
|
ARG BUILD_DATE
|
|
ARG GIT_REPO="https://git.k2patel.in/k2patel/docker-postfix"
|
|
ARG VCS_REF
|
|
ARG VERSION="2.0"
|
|
ARG NAME="dockerized-${COMPONENT}"
|
|
ARG DESCRIPTION="Postfix SMTP relay supporting multiple providers (Maileroo, Mailtrap, SendGrid)"
|
|
ARG DOCUMENTATION="https://git.k2patel.in/k2patel/docker-postfix"
|
|
ARG AUTHOR="k2patel"
|
|
ARG LICENSE="MIT"
|
|
|
|
# Labels
|
|
LABEL org.label-schema.build-date="${BUILD_DATE}" \
|
|
org.label-schema.name="${NAME}" \
|
|
org.label-schema.description="${DESCRIPTION}" \
|
|
org.label-schema.vcs-ref="${VCS_REF}" \
|
|
org.label-schema.vcs-url="${GIT_REPO}" \
|
|
org.label-schema.vendor="${VENDOR}" \
|
|
org.label-schema.version="${VERSION}"
|
|
|
|
# Install required packages
|
|
RUN apk add --no-cache \
|
|
postfix \
|
|
postfix-pcre \
|
|
cyrus-sasl \
|
|
cyrus-sasl-login \
|
|
libsasl \
|
|
ca-certificates \
|
|
bash \
|
|
tzdata \
|
|
mailx
|
|
|
|
# Create necessary directories
|
|
RUN mkdir -p /var/spool/postfix /etc/postfix/sasl
|
|
|
|
# Copy entrypoint script
|
|
COPY run.sh /run.sh
|
|
RUN chmod +x /run.sh
|
|
|
|
# Initialize postfix
|
|
RUN newaliases
|
|
|
|
# Expose SMTP port
|
|
EXPOSE 25
|
|
|
|
# Volumes for persistence
|
|
VOLUME ["/var/spool/postfix"]
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=40s \
|
|
CMD postfix status || exit 1
|
|
|
|
# Run postfix in foreground
|
|
ENTRYPOINT ["/run.sh"]
|