mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-09-12 15:04:22 +08:00
Update Dockerfile
This commit is contained in:
parent
6eaede994e
commit
ee9d85a318
2 changed files with 37 additions and 26 deletions
|
@ -1,12 +1,18 @@
|
||||||
FROM debian:bullseye-slim
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
RUN apt-get update -y && apt-get install -yq ca-certificates curl tar
|
RUN apt-get update -y && apt-get install -yq ca-certificates curl
|
||||||
|
|
||||||
COPY resources/docker/configure.sh /usr/local/bin/configure.sh
|
COPY resources/docker/configure.sh /usr/local/bin/configure.sh
|
||||||
COPY resources/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
COPY resources/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
|
|
||||||
|
RUN sed -i -e 's/__C__/all-in-one/g' /usr/local/bin/configure.sh && \
|
||||||
|
sed -i -e 's/__R__/mail-server/g' /usr/local/bin/configure.sh && \
|
||||||
|
sed -i -e 's/__N__/mail-sqlite/g' /usr/local/bin/configure.sh
|
||||||
|
|
||||||
RUN chmod a+rx /usr/local/bin/*.sh
|
RUN chmod a+rx /usr/local/bin/*.sh
|
||||||
|
|
||||||
|
RUN /usr/local/bin/configure.sh --download
|
||||||
|
|
||||||
RUN useradd stalwart-mail -s /sbin/nologin -M
|
RUN useradd stalwart-mail -s /sbin/nologin -M
|
||||||
RUN mkdir -p /opt/stalwart-mail
|
RUN mkdir -p /opt/stalwart-mail
|
||||||
RUN chown stalwart-mail:stalwart-mail /opt/stalwart-mail
|
RUN chown stalwart-mail:stalwart-mail /opt/stalwart-mail
|
||||||
|
|
|
@ -7,6 +7,7 @@ set -e
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
readonly BASE_URL="https://github.com/stalwartlabs/mail-server/releases/latest/download"
|
readonly BASE_URL="https://github.com/stalwartlabs/mail-server/releases/latest/download"
|
||||||
|
readonly BIN_DIR="/usr/local/bin"
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
downloader --check
|
downloader --check
|
||||||
|
@ -35,33 +36,37 @@ main() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start configuration mode
|
# Start configuration mode
|
||||||
if [ "$#" -eq 1 ] && [ "$1" = "--init" ] ; then
|
if [ "$#" -eq 1 ] && [ "$1" = "--download" ] ; then
|
||||||
init
|
# Detect platform architecture
|
||||||
configure
|
get_architecture || return 1
|
||||||
return 0
|
local _arch="$RETVAL"
|
||||||
|
assert_nz "$_arch" "arch"
|
||||||
|
|
||||||
|
# Download binaries
|
||||||
|
say "⏳ Downloading Stalwart binary for ${_arch}..."
|
||||||
|
local _file="${BIN_DIR}/stalwart-install.tar.gz"
|
||||||
|
local _url="https://github.com/stalwartlabs/__R__/releases/latest/download/stalwart-__N__-${_arch}.tar.gz"
|
||||||
|
ensure downloader "$_url" "$_file" "$_arch"
|
||||||
|
ensure tar zxvf "$_file" -C "$BIN_DIR"
|
||||||
|
ignore rm "$_file"
|
||||||
|
|
||||||
|
say "⏳ Downloading configure tool for ${_arch}..."
|
||||||
|
local _file="${BIN_DIR}/stalwart-install.tar.gz"
|
||||||
|
local _url="${BASE_URL}/stalwart-install-${_arch}.tar.gz"
|
||||||
|
ensure downloader "$_url" "$_file" "$_arch"
|
||||||
|
ensure tar zxvf "$_file" -C "$BIN_DIR"
|
||||||
|
ignore rm "$_file"
|
||||||
|
|
||||||
|
say "⏳ Downloading CLI tool for ${_arch}..."
|
||||||
|
local _file="${BIN_DIR}/stalwart-cli.tar.gz"
|
||||||
|
local _url="${BASE_URL}/stalwart-cli-${_arch}.tar.gz"
|
||||||
|
ensure downloader "$_url" "$_file" "$_arch"
|
||||||
|
ensure tar zxvf "$_file" -C "$BIN_DIR"
|
||||||
|
ignore rm "$_file"
|
||||||
|
else
|
||||||
|
ignore $BIN_DIR/stalwart-install -c __C__ -p /opt/stalwart-mail -d
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect platform architecture
|
|
||||||
get_architecture || return 1
|
|
||||||
local _arch="$RETVAL"
|
|
||||||
assert_nz "$_arch" "arch"
|
|
||||||
|
|
||||||
# Download latest binary
|
|
||||||
say "⏳ Downloading configure tool for ${_arch}..."
|
|
||||||
local _dir
|
|
||||||
_dir="$(ensure mktemp -d)"
|
|
||||||
local _file="${_dir}/stalwart-install.tar.gz"
|
|
||||||
local _url="${BASE_URL}/stalwart-install-${_arch}.tar.gz"
|
|
||||||
ensure mkdir -p "$_dir"
|
|
||||||
ensure downloader "$_url" "$_file" "$_arch"
|
|
||||||
|
|
||||||
# Copy binary
|
|
||||||
say "⬇️ Running configuration wizard..."
|
|
||||||
ensure tar zxvf "$_file" -C "$_dir"
|
|
||||||
ignore $_dir/stalwart-install -p /opt/stalwart-mail -d
|
|
||||||
ignore rm "$_file"
|
|
||||||
ignore rm "$_dir/stalwart-install"
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue