fix: use official stalwart docker image
Build Stalwart Mail Yolk / build (push) Failing after 14m19s

This commit is contained in:
2026-06-16 00:42:01 +03:00
parent b020014e3d
commit 58b378b194
2 changed files with 10 additions and 42 deletions
+6 -30
View File
@@ -1,4 +1,4 @@
FROM debian:bookworm-slim FROM ghcr.io/stalwartlabs/mail-server:latest
LABEL author="RefoselTeam" maintainer="admin@refoseltw.ru" LABEL author="RefoselTeam" maintainer="admin@refoseltw.ru"
@@ -7,51 +7,27 @@ LABEL org.opencontainers.image.licenses=MIT
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies # Install additional tools
RUN apt update \ RUN apt update \
&& apt upgrade -y \ && apt upgrade -y \
&& apt install -y \ && apt install -y \
curl \ curl \
gnupg \
ca-certificates \
tini \
tzdata \
unzip \
git \ git \
tini \
&& apt clean \ && apt clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Create directories # Create directories
RUN mkdir -p /home/container/stalwart-mail/bin \ RUN mkdir -p /home/container/stalwart-mail/data \
&& mkdir -p /home/container/stalwart-mail/data \
&& mkdir -p /home/container/stalwart-mail/certs \ && mkdir -p /home/container/stalwart-mail/certs \
&& mkdir -p /home/container/stalwart-mail/logs && mkdir -p /home/container/stalwart-mail/logs
# Install Stalwart Mail Server
ARG STALWART_VERSION=0.16.8
RUN cd /tmp \
&& curl -sSL -o stalwart.tar.gz "https://github.com/stalwartlabs/stalwart/releases/download/v${STALWART_VERSION}/stalwart-x86_64-unknown-linux-gnu.tar.gz" \
&& tar xzf stalwart.tar.gz \
&& ls -la /tmp/ \
&& find /tmp -name "stalwart*" -type f \
&& cp /tmp/stalwart-mail /home/container/stalwart-mail/bin/stalwart-mail \
&& chmod +x /home/container/stalwart-mail/bin/stalwart-mail \
&& rm -rf /tmp/*
# Setup user
RUN useradd -m -d /home/container -s /bin/bash container \
&& chown -R container:container /home/container
USER container
ENV USER=container HOME=/home/container
WORKDIR /home/container
EXPOSE 8080 465 587 993 995 4190 EXPOSE 8080 465 587 993 995 4190
STOPSIGNAL SIGINT STOPSIGNAL SIGINT
COPY --chown=container:container ./entrypoint.sh /entrypoint.sh COPY --chown=root:root ./entrypoint.sh /entrypoint.sh
COPY --chown=container:container ./config.toml /entrypoint-config.toml COPY --chown=root:root ./config.toml /entrypoint-config.toml
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/usr/bin/tini", "-g", "--"] ENTRYPOINT ["/usr/bin/tini", "-g", "--"]
+4 -12
View File
@@ -11,11 +11,8 @@ export TZ
cd /home/container || exit 1 cd /home/container || exit 1
# Stalwart paths # Stalwart paths
STALWART_HOME="/home/container/stalwart-mail" STALWART_HOME="/var/lib/stalwart-mail"
STALWART_CONFIG="${STALWART_HOME}/config.toml" STALWART_CONFIG="/etc/stalwart-mail/config.toml"
STALWART_DATA="${STALWART_HOME}/data"
STALWART_CERTS="${STALWART_HOME}/certs"
STALWART_LOGS="${STALWART_HOME}/logs"
# Create config from template if not exists # Create config from template if not exists
if [ ! -f "${STALWART_CONFIG}" ]; then if [ ! -f "${STALWART_CONFIG}" ]; then
@@ -24,15 +21,13 @@ if [ ! -f "${STALWART_CONFIG}" ]; then
# Replace placeholders with environment variables # Replace placeholders with environment variables
sed -i "s|{{MAIL_DOMAIN}}|${MAIL_DOMAIN:-mail.example.com}|g" "${STALWART_CONFIG}" sed -i "s|{{MAIL_DOMAIN}}|${MAIL_DOMAIN:-mail.example.com}|g" "${STALWART_CONFIG}"
sed -i "s|{{MAIL_HOSTNAME}}|${MAIL_HOSTNAME:-$(hostname)|g" "${STALWART_CONFIG}" sed -i "s|{{MAIL_HOSTNAME}}|${MAIL_HOSTNAME:-$(hostname)}|g" "${STALWART_CONFIG}"
sed -i "s|{{ADMIN_EMAIL}}|${ADMIN_EMAIL:-admin@${MAIL_DOMAIN:-mail.example.com}}|g" "${STALWART_CONFIG}" sed -i "s|{{ADMIN_EMAIL}}|${ADMIN_EMAIL:-admin@${MAIL_DOMAIN:-mail.example.com}}|g" "${STALWART_CONFIG}"
sed -i "s|{{HTTP_PORT}}|${HTTP_PORT:-8080}|g" "${STALWART_CONFIG}" sed -i "s|{{HTTP_PORT}}|${HTTP_PORT:-8080}|g" "${STALWART_CONFIG}"
sed -i "s|{{SMTP_PORT}}|${SMTP_PORT:-465}|g" "${STALWART_CONFIG}" sed -i "s|{{SMTP_PORT}}|${SMTP_PORT:-465}|g" "${STALWART_CONFIG}"
sed -i "s|{{SUBMISSION_PORT}}|${SUBMISSION_PORT:-587}|g" "${STALWART_CONFIG}" sed -i "s|{{SUBMISSION_PORT}}|${SUBMISSION_PORT:-587}|g" "${STALWART_CONFIG}"
sed -i "s|{{IMAP_PORT}}|${IMAP_PORT:-993}|g" "${STALWART_CONFIG}" sed -i "s|{{IMAP_PORT}}|${IMAP_PORT:-993}|g" "${STALWART_CONFIG}"
sed -i "s|{{MANAGESIEVE_PORT}}|${MANAGESIEVE_PORT:-4190}|g" "${STALWART_CONFIG}" sed -i "s|{{MANAGESIEVE_PORT}}|${MANAGESIEVE_PORT:-4190}|g" "${STALWART_CONFIG}"
sed -i "s|{{STORAGE_DATA}}|${STALWART_DATA}|g" "${STALWART_CONFIG}"
sed -i "s|{{STORAGE_LOGS}}|${STALWART_LOGS}|g" "${STALWART_CONFIG}"
echo "Configuration generated." echo "Configuration generated."
fi fi
@@ -52,13 +47,10 @@ if [ ! -f "${STALWART_HOME}/.admin_created" ]; then
echo "==========================================" echo "=========================================="
echo "" echo ""
# Create admin account
/home/container/stalwart-mail/bin/stalwart-mail --config "${STALWART_CONFIG}" --write-config
touch "${STALWART_HOME}/.admin_created" touch "${STALWART_HOME}/.admin_created"
fi fi
# Clone Git repos if GIT_REPOS is set (for custom configs, filters, etc.) # Clone Git repos if GIT_REPOS is set
if [ ! -z "${GIT_REPOS}" ]; then if [ ! -z "${GIT_REPOS}" ]; then
IFS=',' read -ra REPOS <<< "$GIT_REPOS" IFS=',' read -ra REPOS <<< "$GIT_REPOS"
for repo in "${REPOS[@]}"; do for repo in "${REPOS[@]}"; do