Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Optimize Core containers

aapanel.com49b5909ed84f
diff --git a/Dockerfiles/core/Dockerfile b/Dockerfiles/core/Dockerfile
index 761a31a2..5c73117e 100644
--- a/Dockerfiles/core/Dockerfile
+++ b/Dockerfiles/core/Dockerfile
@@ -6,6 +6,16 @@ LABEL maintainer="https://github.com/aaPanel/Billion-Mail"
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
+
+# Platform-specific binary copy
+ARG TARGETARCH
+COPY core/billionmail-${TARGETARCH} /opt/billionmail/core/billionmail
+COPY core/manifest /opt/billionmail/core/manifest
+COPY core/languages /opt/billionmail/core/languages
+COPY core/public /opt/billionmail/core/public
+COPY core/resource /opt/billionmail/core/resource
+COPY core/template /opt/billionmail/core/template
+
# Copy file
# COPY repositories /etc/apk/repositories
COPY stop-supervisor.sh /stop-supervisor.sh
@@ -26,7 +36,7 @@ RUN apk add --no-cache \
iptables \
ipset \
&& rm -rf /var/cache/apk/* \
- && chmod +x /stop-supervisor.sh /core.sh /restart_fail2ban.sh
+ && chmod +x /stop-supervisor.sh /core.sh /restart_fail2ban.sh /opt/billionmail/core/billionmail
# Copy file
diff --git a/Dockerfiles/core/core.sh b/Dockerfiles/core/core.sh
index 488430cf..b991e3df 100644
--- a/Dockerfiles/core/core.sh
+++ b/Dockerfiles/core/core.sh
@@ -55,15 +55,6 @@ fi
# fi
cp -rf /opt/billionmail/conf/core/fail2ban_init/filter.d/*.conf /etc/fail2ban/filter.d/
-if [ ! -d "/opt/billionmail/core/public/" ]; then
- mkdir -p /opt/billionmail/core/public/dist
- mkdir -p /opt/billionmail/core/public/html
-fi
-
-if [ ! -d "/opt/billionmail/core/template/" ]; then
- mkdir /opt/billionmail/core/template
-fi
-
if [ ! -d "/opt/billionmail/core/logs/" ]; then
mkdir /opt/billionmail/core/logs
fi
@@ -73,14 +64,7 @@ if [ ! -f "/opt/billionmail/core/logs/access-$(date -u +"%Y%m%d").log" ]; then
fi
cd /opt/billionmail/core/
-rm -f billionmail
-echo $(arch)
-if [ ! -f "billionmail-$(arch)" ]; then
- echo "billionmail-$(arch) not found"
- exit 1
-fi
-ln -sf billionmail-$(arch) billionmail
-chmod +x billionmail*
+chmod +x billionmail
exec "$@"
\ No newline at end of file
diff --git a/core/go-build.sh b/core/go-build.sh
index 6699a3f3..a1da738a 100644
--- a/core/go-build.sh
+++ b/core/go-build.sh
@@ -51,38 +51,38 @@ fi
if [[ "$PLATFORMS" == "all" || "$PLATFORMS" == "x86" ]]; then
- # amd64 x86_64
- echo "build start amd64 : x86_64"
- rm -f billionmail-x86_64
+ # amd64
+ echo "build start amd64"
+ rm -f billionmail-amd64
export GOOS=linux
export GOARCH=amd64
- go build -ldflags="-s -w" -o billionmail-x86_64 main.go
- if [ ! -f "billionmail-x86_64" ]; then
- echo "build x86_64 failed"
+ go build -ldflags="-s -w" -o billionmail-amd64 main.go
+ if [ ! -f "billionmail-amd64" ]; then
+ echo "build amd64 failed"
exit 1
fi
- check_file=$(file billionmail-x86_64 | grep "x86-64,")
+ check_file=$(file billionmail-amd64 | grep "x86-64,")
if [ -z "${check_file}" ];then
- echo "billionmail-x86_64 is not an arm64 file, package failed.";
+ echo "billionmail-amd64 is not an arm64 file, package failed.";
exit 0;
fi
fi
if [[ "$PLATFORMS" == "all" || "$PLATFORMS" == "arm" ]]; then
- # arm64 aarch64
- echo "build start arm64 : aarch64"
- rm -f billionmail-aarch64
+ # arm64
+ echo "build start arm64"
+ rm -f billionmail-arm64
export GOOS=linux
export GOARCH=arm64
- go build -ldflags="-s -w" -o billionmail-aarch64 main.go
- if [ ! -f "billionmail-aarch64" ]; then
- echo "build aarch64 failed"
+ go build -ldflags="-s -w" -o billionmail-arm64 main.go
+ if [ ! -f "billionmail-arm64" ]; then
+ echo "build arm64 failed"
exit 1
fi
- check_file=$(file billionmail-aarch64 | grep "ARM aarch64,")
+ check_file=$(file billionmail-arm64 | grep -E "ARM|aarch64")
if [ -z "${check_file}" ];then
- echo "billionmail-aarch64 is not an arm64 file, package failed.";
+ echo "billionmail-arm64 is not an arm64 file, package failed.";
exit 0;
fi
fi
diff --git a/mail_users.sh b/mail_users.sh
index d7b4a6dd..d67299ba 100644
--- a/mail_users.sh
+++ b/mail_users.sh
@@ -452,7 +452,7 @@ Default_info() {
if [ "${HTTPS_PORT}" = "443" ];then
echo "BillionMail Internal Address: ${pool}://${LOCAL_IP}/${SafePath}"
else
- echo "BillionMail Internal Address: ${pool}://${LOCAL_IP}:${HTTPS_PORT}${SafePath}"
+ echo "BillionMail Internal Address: ${pool}://${LOCAL_IP}:${HTTPS_PORT}/${SafePath}"
fi
echo -e "Username: ${ADMIN_USERNAME} \nPassword: ${ADMIN_PASSWORD}"