mirror of
https://github.com/ledgersmb/ledgersmb-docker.git
synced 2025-04-19 14:47:12 -04:00
commit
fb18381bdd
64
Dockerfile
64
Dockerfile
@ -1,4 +1,4 @@
|
||||
FROM debian:stretch
|
||||
FROM debian:buster-slim
|
||||
MAINTAINER Freelock john@freelock.com
|
||||
|
||||
# Install Perl, Tex, Starman, psql client, and all dependencies
|
||||
@ -11,35 +11,39 @@ MAINTAINER Freelock john@freelock.com
|
||||
# That mitigates issues where the PG instance is running a newer version than this container
|
||||
|
||||
RUN echo "APT::Install-Recommends \"false\";\nAPT::Install-Suggests \"false\";" > /etc/apt/apt.conf.d/00recommends && \
|
||||
DEBIAN_FRONTEND="noninteractive" apt-mark hold sensible-utils && \
|
||||
DEBIAN_FRONTEND="noninteractive" apt-get -y update && \
|
||||
DEBIAN_FRONTEND="noninteractive" apt-get -y upgrade && \
|
||||
DEBIAN_FRONTEND="noninteractive" apt-get -y install \
|
||||
wget ca-certificates gnupg \
|
||||
libcgi-emulate-psgi-perl libcgi-simple-perl libconfig-inifiles-perl \
|
||||
libdbd-pg-perl libdbi-perl libdata-uuid-perl libdatetime-perl \
|
||||
libdatetime-format-strptime-perl libio-stringy-perl \
|
||||
libjson-xs-perl libcpanel-json-xs-perl liblist-moreutils-perl \
|
||||
libauthen-sasl-perl libcgi-emulate-psgi-perl libconfig-inifiles-perl \
|
||||
libcookie-baker-perl libdbd-pg-perl libdbi-perl libdata-uuid-perl \
|
||||
libdatetime-perl libdatetime-format-strptime-perl \
|
||||
libemail-sender-perl libemail-stuffer-perl libfile-find-rule-perl \
|
||||
libhtml-escape-perl libhttp-headers-fast-perl libio-stringy-perl \
|
||||
libjson-maybexs-perl libcpanel-json-xs-perl libjson-pp-perl \
|
||||
liblist-moreutils-perl \
|
||||
liblocale-maketext-perl liblocale-maketext-lexicon-perl \
|
||||
liblog-log4perl-perl libmime-lite-perl libmime-types-perl \
|
||||
libmath-bigint-gmp-perl libmodule-runtime-perl libmoose-perl \
|
||||
liblog-log4perl-perl libmime-types-perl \
|
||||
libmath-bigint-gmp-perl libmodule-runtime-perl libmoo-perl \
|
||||
libmoox-types-mooselike-perl libmoose-perl \
|
||||
libmoosex-nonmoose-perl libnumber-format-perl \
|
||||
libpgobject-perl libpgobject-simple-perl libpgobject-simple-role-perl \
|
||||
libpgobject-type-bigfloat-perl libpgobject-type-datetime-perl \
|
||||
libpgobject-type-bytestring-perl libpgobject-util-dbmethod-perl \
|
||||
libpgobject-util-dbadmin-perl libplack-perl libfile-find-rule-perl \
|
||||
libplack-middleware-reverseproxy-perl \
|
||||
libpgobject-util-dbadmin-perl libplack-perl \
|
||||
libplack-builder-conditionals-perl libplack-middleware-reverseproxy-perl \
|
||||
libplack-request-withencoding-perl libscope-guard-perl \
|
||||
libsession-storage-secure-perl libstring-random-perl \
|
||||
libtemplate-perl libtext-csv-perl libtext-csv-xs-perl \
|
||||
libtext-markdown-perl libxml-simple-perl \
|
||||
libnamespace-autoclean-perl \
|
||||
libimage-size-perl \
|
||||
libtext-markdown-perl libtry-tiny-perl libversion-compare-perl \
|
||||
libxml-simple-perl libnamespace-autoclean-perl \
|
||||
starman starlet libhttp-parser-xs-perl \
|
||||
libtemplate-plugin-latex-perl libtex-encode-perl \
|
||||
libxml-twig-perl libopenoffice-oodoc-perl \
|
||||
libexcel-writer-xlsx-perl libspreadsheet-writeexcel-perl \
|
||||
libclass-c3-xs-perl \
|
||||
texlive-latex-recommended \
|
||||
texlive-xetex fonts-liberation \
|
||||
starman \
|
||||
libopenoffice-oodoc-perl \
|
||||
ssmtp \
|
||||
lsb-release && \
|
||||
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
|
||||
(wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -) && \
|
||||
@ -51,7 +55,7 @@ RUN echo "APT::Install-Recommends \"false\";\nAPT::Install-Suggests \"false\";"
|
||||
|
||||
|
||||
# Build time variables
|
||||
ENV LSMB_VERSION 1.7.0-beta1
|
||||
ENV LSMB_VERSION master
|
||||
ENV NODE_PATH /usr/local/lib/node_modules
|
||||
|
||||
|
||||
@ -64,13 +68,14 @@ ENV DOJO_Build_Deps git make gcc libperl-dev curl nodejs
|
||||
# These packages can be removed after the dojo build
|
||||
ENV DOJO_Build_Deps_removal ${DOJO_Build_Deps} nodejs
|
||||
|
||||
RUN wget --quiet -O - https://deb.nodesource.com/setup_8.x | bash -
|
||||
RUN wget --quiet -O - https://deb.nodesource.com/setup_12.x | bash -
|
||||
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y update && \
|
||||
DEBIAN_FRONTEND="noninteractive" apt-get -y install ${DOJO_Build_Deps} && \
|
||||
cd /srv && \
|
||||
git clone --recursive -b $LSMB_VERSION https://github.com/ledgersmb/LedgerSMB.git ledgersmb && \
|
||||
cd ledgersmb && \
|
||||
(curl -L https://cpanmin.us | perl - App::cpanminus) && \
|
||||
cpanm --reinstall --notest Locale::Country Locale::Codes Locale::Language && \
|
||||
cpanm --quiet --notest \
|
||||
--with-feature=starman \
|
||||
--with-feature=latex-pdf-ps \
|
||||
@ -92,26 +97,23 @@ ENV NODE_PATH=
|
||||
|
||||
# Configure outgoing mail to use host, other run time variable defaults
|
||||
|
||||
## sSMTP
|
||||
ENV SSMTP_ROOT ar@example.com
|
||||
ENV SSMTP_MAILHUB 172.17.0.1
|
||||
ENV SSMTP_HOSTNAME 172.17.0.1
|
||||
#ENV SSMTP_USE_STARTTLS
|
||||
#ENV SSMTP_AUTH_USER
|
||||
#ENV SSMTP_AUTH_PASS
|
||||
ENV SSMTP_FROMLINE_OVERRIDE YES
|
||||
#ENV SSMTP_AUTH_METHOD
|
||||
## MAIL
|
||||
ENV LSMB_MAIL_SMTPHOST 172.17.0.1
|
||||
#ENV LSMB_MAIL_SMTPPORT 25
|
||||
#ENV LSMB_MAIL_SMTPSENDER_HOSTNAME (container hostname)
|
||||
#ENV LSMB_MAIL_SMTPTLS
|
||||
#ENV LSMB_MAIL_SMTPUSER
|
||||
#ENV LSMB_MAIL_SMTPPASS
|
||||
#ENV LSMB_MAIL_SMTPAUTHMECH
|
||||
|
||||
ENV POSTGRES_HOST postgres
|
||||
ENV POSTGRES_PORT 5432
|
||||
ENV DEFAULT_DB lsmb
|
||||
|
||||
COPY start.sh /usr/local/bin/start.sh
|
||||
COPY update_ssmtp.sh /usr/local/bin/update_ssmtp.sh
|
||||
|
||||
RUN chown www-data /etc/ssmtp /etc/ssmtp/ssmtp.conf && \
|
||||
chmod +x /usr/local/bin/update_ssmtp.sh /usr/local/bin/start.sh && \
|
||||
mkdir -p /var/www
|
||||
RUN chmod +x /usr/local/bin/start.sh && \
|
||||
mkdir -p /var/www
|
||||
|
||||
# Work around an aufs bug related to directory permissions:
|
||||
RUN mkdir -p /tmp && \
|
||||
|
97
start.sh
97
start.sh
@ -1,8 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
update_ssmtp.sh
|
||||
cd /srv/ledgersmb
|
||||
|
||||
if [[ -n "$SSMTP_ROOT" ]]; then
|
||||
echo "\$SSMTP_ROOT set; parameter is deprecated and will be ignored"
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_FROMLINE_OVERRIDE" ]]; then
|
||||
echo "\$SSMTP_FROMLINE_OVERRIDE set; parameter is deprecated and will be ignored"
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_MAILHUB" ]]; then
|
||||
echo "\$SSMTP_MAILHUB set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPHOST" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPHOST setting from \$SSMTP_MAILHUB"
|
||||
LSMB_MAIL_SMTPHOST=${SSMTP_MAILHUB%:*}
|
||||
fi
|
||||
if [[ -z "$LSMB_MAIL_SMTPPORT" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPPORT setting from \$SSMTP_MAILHUB"
|
||||
LSMB_MAIL_SMTPPORT=${SSMTP_MAILHUB#*:}
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_HOSTNAME" ]]; then
|
||||
echo "\$SSMTP_HOSTNAME set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPSENDER_HOSTNAME" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPSENDER_HOSTNAME setting from \$SSMTP_HOSTNAME"
|
||||
LSMB_MAIL_SMTPSENDER_HOSTNAME=$SSMTP_HOSTNAME
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_USE_STARTTLS" ]]; then
|
||||
echo "\$SSMTP_USE_STARTTLS set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPTLS" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPSENDER_HOSTNAME setting from \$SSMTP_USE_STARTTLS"
|
||||
LSMB_MAIL_SMTPTLS=$SSMTP_USE_STARTTLS
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_AUTH_USER" ]]; then
|
||||
echo "\$SSMTP_AUTH_USER set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPUSER" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPUSER setting from \$SSMTP_AUTH_USER"
|
||||
LSMB_MAIL_SMTPUSER=$SSMTP_AUTH_USER
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_AUTH_PASS" ]]; then
|
||||
echo "\$SSMTP_AUTH_PASS set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPPASS" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPPASS setting from \$SSMTP_AUTH_PASS"
|
||||
LSMB_MAIL_SMTPPASS=$SSMTP_AUTH_PASS
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
if [[ -n "$SSMTP_AUTH_METHOD" ]]; then
|
||||
echo "\$SSMTP_AUTH_METHOD set; parameter is deprecated"
|
||||
if [[ -z "$LSMB_MAIL_SMTPAUTHMECH" ]]; then
|
||||
echo " Deriving \$LSMB_MAIL_SMTPAUTHMECH setting from \$SSMTP_AUTH_METHOD"
|
||||
LSMB_MAIL_SMTPAUTHMECH=$SSMTP_AUTH_METHOD
|
||||
fi
|
||||
LSMB_HAVE_DEPRECATED=1
|
||||
fi
|
||||
|
||||
if [[ -n "$LSMB_HAVE_DEPRECATED" ]]; then
|
||||
echo "!!! DEPRECATED \$SSMTP_* PARAMETERS WILL BE REMOVED in the 1.9 image!!!"
|
||||
fi
|
||||
# This was never a parameter: ?
|
||||
# if [[ -n "$SSMTP_USE_TLS" ]]; then
|
||||
# echo "\$SSMTP_USE_TLS set; parameter is deprecated"
|
||||
# if [[ -z "$LSMB_MAIL_SMTPTLS" ]]; then
|
||||
# echo " Deriving \$LSMB_MAIL_SMTPSENDER_HOSTNAME setting from \$SSMTP_MAILHUB"
|
||||
# if [[ "$SSMTP_USE_TLS" == "yes" ]]; then
|
||||
# LSMB_MAIL_SMTPTLS=raw
|
||||
# else
|
||||
# LSMB_MAIL_SMTPTLS=no
|
||||
# fi
|
||||
# fi
|
||||
# fi
|
||||
|
||||
|
||||
if [[ ! -f ledgersmb.conf ]]; then
|
||||
cat <<EOF >/tmp/ledgersmb.conf
|
||||
[main]
|
||||
@ -14,7 +91,14 @@ port = $POSTGRES_PORT
|
||||
default_db = $DEFAULT_DB
|
||||
|
||||
[mail]
|
||||
sendmail = /usr/sbin/ssmtp
|
||||
${LSMB_MAIL_SMTPHOST:+smtphost=$LSMB_MAIL_SMTPHOST
|
||||
}${LSMB_MAIL_SMTPPORT:+smtpport=$LSMB_MAIL_SMTPPORT
|
||||
}${LSMB_MAIL_SMTPSENDER_HOSTNAME:+smtpsender_hostname=$LSMB_MAIL_SMTPSENDER_HOSTNAME
|
||||
}${LSMB_MAIL_SMTPTLS:+smtptls=$LSMB_MAIL_SMTPTLS
|
||||
}${LSMB_MAIL_SMTPUSER:+smtpuser=$LSMB_MAIL_SMTPUSER
|
||||
}${LSMB_MAIL_SMTPPASS:+smtppass=$LSMB_MAIL_SMTPPASS
|
||||
}${LSMB_MAIL_SMTPAUTHMECH:+smtpauthmech=$LSMB_MAIL_SMTPAUTHMECH
|
||||
}
|
||||
|
||||
EOF
|
||||
export LSMB_CONFIG_FILE='/tmp/ledgersmb.conf'
|
||||
@ -32,5 +116,12 @@ fi
|
||||
# starman instance (instead of just the worker, which will immediately
|
||||
# get restarted); it also has a positive effect on memory use
|
||||
|
||||
exec starman --port 5762 --workers ${LSMB_WORKERS:-5} -I lib -I old/lib \
|
||||
echo '--------- LEDGERSMB CONFIGURATION: ledgersmb.conf'
|
||||
cat ${LSMB_CONFIG_FILE:-ledgersmb.conf}
|
||||
echo '--------- LEDGERSMB CONFIGURATION --- END'
|
||||
|
||||
# ':5762:' suppresses an uninitialized variable warning in starman
|
||||
# the last colon means "don't connect using tls"; without it, there's a warning
|
||||
exec starman --listen :5762: --max-workers ${LSMB_WORKERS:-5} \
|
||||
-I lib -I old/lib \
|
||||
--preload-app bin/ledgersmb-server.psgi
|
||||
|
@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
ConfiguredComment='# install script update_ssmtp.sh has configured ssmtp'
|
||||
grep -qc "$ConfiguredComment" /etc/ssmtp.conf && {
|
||||
echo "smtp configured."
|
||||
exit
|
||||
}
|
||||
|
||||
[ -z "$SSMTP_FROMLINE_OVERRIDE" ] || echo "SSMTP_FROMLINE_OVERRIDE (DEPRECATED) won't be supported as of the LedgerSMB 1.8 Docker images"
|
||||
[ -z "$SSMTP_AUTH_METHOD" ] || echo "SSMTP_AUTH_METHOD (DEPRECATED) won't be supported as of the LedgerSMB 1.8 Docker images"
|
||||
|
||||
|
||||
sed -i \
|
||||
-e "s/\(root=\).*\$/\1$SSMTP_ROOT/g" \
|
||||
-e "s/\(mailhub=\).*\$/\1$SSMTP_MAILHUB/g" \
|
||||
-e "s/\(hostname=\).*\$/\1$SSMTP_HOSTNAME/g" \
|
||||
/etc/ssmtp/ssmtp.conf
|
||||
[ -z "$SSMTP_USE_STARTTLS" ] || echo "UseSTARTTLS=$SSMTP_USE_STARTTLS" >> /etc/ssmtp/ssmtp.conf
|
||||
[ -z "$SSMTP_AUTH_USER" ] || echo "AuthUser=$SSMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf
|
||||
[ -z "$SSMTP_AUTH_PASS" ] || echo "AuthPass=$SSMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf
|
||||
[ -z "$SSMTP_AUTH_METHOD" ] || echo "AuthMethod=$SSMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf
|
||||
[ -z "$SSMTP_FROMLINE_OVERRIDE" ] || echo "FromLineOverride=$SSMTP_FROMLINE_OVERRIDE" >> /etc/ssmtp/ssmtp.conf
|
||||
echo "$ConfiguredComment" >> /etc/ssmtp/ssmtp.conf
|
Loading…
Reference in New Issue
Block a user