Files
plane/email/Dockerfile
Manish Gupta ee6e7596bb [INFRA-77] feat: add email service and SMTP configuration to docker-compose (#3098)
* feat: add email service and SMTP configuration to docker-compose

- Introduced a new email service in docker-compose with environment variables for SMTP configuration.
- Updated Caddyfile to route SMTP traffic for email service.
- Added necessary SMTP ports and health checks for the email service.
- Updated variables.env to include email-related configurations and replicas.

* refactor: clean up Caddyfile SMTP routing configuration

- Simplified the indentation and formatting of the SMTP routing sections in the Caddyfile.
- Ensured consistent structure for the proxy routes for email services on specified ports.

* fix: update SMTP domain binding in Caddyfile

- Changed the SMTP domain binding in the Caddyfile to use '0.0.0.0' for specified ports (10025, 10465, 10587) to allow connections from all network interfaces.
- This adjustment enhances the accessibility of the email service routing configuration.

* fix: update mail server testing instructions in README

- Changed placeholder from `<mail-domain>` to `<host-domain>` for clarity in SMTP connection testing instructions.
- This update improves the accuracy of the documentation for users testing their mail server setup.

* feat: enhance email service configuration in docker-compose and Caddyfile

- Added SMTP environment variables to coolify-compose.yml for better email service configuration.
- Updated docker-compose-caddy.yml to remove redundant SMTP_DOMAIN variable.
- Modified Caddyfile to simplify SMTP domain binding for email service routes.
- Ensured proper permissions for TLS directory in email Dockerfile.

* refactor: remove email service environment variables in coolify-compose.yml

---------

Co-authored-by: akshat5302 <akshatjain9782@gmail.com>
2025-05-21 13:29:28 +05:30

61 lines
1.4 KiB
Docker

FROM --platform=$BUILDPLATFORM tonistiigi/binfmt AS binfmt
FROM golang:alpine3.20 AS builder
WORKDIR /app
RUN apk update && \
apk upgrade && \
apk add git && \
go install github.com/goreleaser/goreleaser/v2@latest
COPY . .
RUN goreleaser build --snapshot --clean --single-target --output=./email-server
FROM alpine:latest AS runner
RUN apk update && \
apk upgrade && \
apk add ca-certificates openssl
WORKDIR /opt/email
LABEL maintainer="engineering@plane.so" \
app="email-server" \
version="1.0.0"
ENV SMTP_DOMAIN=localhost \
EMAIL_SAVE_ENDPOINT="" \
LOG_LEVEL="info" \
TZ=UTC
COPY --from=builder /app/email-server /opt/email/email-server
COPY --from=builder /app/spam.txt /opt/email/spam.txt
COPY --from=builder /app/domain-blacklist.txt /opt/email/domain-blacklist.txt
COPY --from=builder /app/cert-gen.sh /opt/email/cert-gen.sh
RUN mkdir -p /opt/email/emails && \
mkdir -p /opt/email/keys && \
chmod +x /opt/email/cert-gen.sh
EXPOSE 10025 10465 10587
# create a user and group - app-user
RUN addgroup -S app-group && adduser -S app-user -G app-group
RUN mkdir -p /opt/email/tls && \
chown -R app-user:app-group /opt/email && \
chmod 755 /opt/email/emails && \
chmod 777 /opt/email/keys && \
chmod 777 /opt/email/tls
VOLUME [ "/opt/email/tls" ]
USER app-user
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD nc -zv localhost 25 || exit 1
CMD [ "/opt/email/email-server"]