mirror of
https://github.com/friendica/docker
synced 2024-09-25 10:51:19 +02:00
Move SSMTP to image again & just exclude local.ini.php from rsync
This commit is contained in:
parent
836f275fee
commit
2e71bd0c90
|
@ -16,25 +16,6 @@ The Dockerfiles use the default images as base image and build on top of it.
|
||||||
Examples | Descriptions
|
Examples | Descriptions
|
||||||
-------- | -------
|
-------- | -------
|
||||||
[cron](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/cron) | uses supervisor to run the cron job inside the container (so no extra container is needed).
|
[cron](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/cron) | uses supervisor to run the cron job inside the container (so no extra container is needed).
|
||||||
[smtp](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/smtp) | adds SMTP support to the Friendica container (necessary if you want to have mail support in Friendica).
|
|
||||||
|
|
||||||
### SMTP settings <a id="smtpsetting"></a>
|
|
||||||
|
|
||||||
The binary `ssmtp` is used for the `mail()` support of Friendica.
|
|
||||||
|
|
||||||
You have to set the `--hostname/-h` parameter correctly to use the right domainname for the `mail()` command.
|
|
||||||
|
|
||||||
You have to set a valid SMTP-MTA for the `SMTP` environment variable to enable mail support in Friendica.
|
|
||||||
A valid SMTP-MTA would be, for example, `mx.example.org`.
|
|
||||||
|
|
||||||
The following environment variables are possible for the SMTP examples.
|
|
||||||
|
|
||||||
- `SITENAME` The name of the Friendica node. (**required** - Default: `Testsite`)
|
|
||||||
- `SMTP` Address of the SMTP Mail-Gateway. (**required** - Default: `localhost`)
|
|
||||||
- `SMTP_FROM` Sender user-part of the address. (Default: `no-reply` - e.g. no-reply@friendica.local)
|
|
||||||
- `SMTP_AUTH_USER` Username for the SMTP Mail-Gateway. (Default: empty)
|
|
||||||
- `SMTP_AUTH_PASS` Password for the SMTP Mail-Gateway. (Default: empty)
|
|
||||||
- `SMTP_AUTH_METHOD` Authentication method for the SMTP Mail-Gateway. (Default: empty/plain text)
|
|
||||||
|
|
||||||
## docker-compose
|
## docker-compose
|
||||||
|
|
||||||
|
|
|
@ -1,41 +1,4 @@
|
||||||
FROM friendica/server:apache
|
FROM friendica/server:apache
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
|
||||||
RUN set -ex; \
|
|
||||||
\
|
|
||||||
apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
# For mail() support
|
|
||||||
ssmtp \
|
|
||||||
; \
|
|
||||||
rm -rf /var/lib/apt/lists/*;
|
|
||||||
|
|
||||||
ENV SMTP localhost
|
|
||||||
ENV SMTP_FROM no-reply
|
|
||||||
|
|
||||||
ENV SITENAME "Testsite"
|
|
||||||
|
|
||||||
# Setup SSMTP
|
|
||||||
RUN set -ex; \
|
|
||||||
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd ;\
|
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd ;\
|
|
||||||
# add possible mail-senders
|
|
||||||
{\
|
|
||||||
echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
|
|
||||||
echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
|
|
||||||
} > /etc/ssmtp/revaliases;\
|
|
||||||
# replace ssmtp.conf settings
|
|
||||||
{\
|
|
||||||
echo "root=$SMTP_FROM@$HOSTNAME" ;\
|
|
||||||
echo "hostname=$HOSTNAME" ;\
|
|
||||||
echo "mailhub=$SMTP" ;\
|
|
||||||
echo "FromLineOverride=YES" ;\
|
|
||||||
[ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" ;\
|
|
||||||
[ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" ;\
|
|
||||||
[ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" ;\
|
|
||||||
[ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" ;\
|
|
||||||
[ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" ;\
|
|
||||||
} > /etc/ssmtp/ssmtp.conf;
|
|
||||||
|
|
||||||
RUN mkdir -p /usr/src/config
|
RUN mkdir -p /usr/src/config
|
||||||
COPY addon.ini.php /usr/src/config/
|
COPY addon.ini.php /usr/src/config/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
MYSQL_PASSWORD=
|
MYSQL_PASSWORD=test
|
||||||
MYSQL_DATABASE=friendica
|
MYSQL_DATABASE=friendica
|
||||||
MYSQL_USER=friendica
|
MYSQL_USER=friendica
|
||||||
MYSQL_HOST=db
|
MYSQL_HOST=db
|
||||||
|
|
|
@ -22,10 +22,10 @@ services:
|
||||||
- friendica:/var/www/html
|
- friendica:/var/www/html
|
||||||
environment:
|
environment:
|
||||||
- FRIENDICA_ADMIN_MAIL=
|
- FRIENDICA_ADMIN_MAIL=
|
||||||
- FRIENDICA_TZ=
|
- FRIENDICA_TZ=Europe/Berlin
|
||||||
- FRIENDICA_LANG=
|
- FRIENDICA_LANG=de
|
||||||
- SITENAME=
|
- SITENAME=Testsite
|
||||||
- SMTP=
|
- SMTP=smtp.philipp.info
|
||||||
env_file:
|
env_file:
|
||||||
- db.env
|
- db.env
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -40,9 +40,6 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- friendica:/var/www/html
|
- friendica:/var/www/html
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
environment:
|
|
||||||
- SITENAME=
|
|
||||||
- SMTP=
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
hostname: friendica.local
|
hostname: friendica.local
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
FROM friendica/server:apache
|
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
|
||||||
RUN set -ex; \
|
|
||||||
\
|
|
||||||
apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
# For mail() support
|
|
||||||
ssmtp \
|
|
||||||
; \
|
|
||||||
rm -rf /var/lib/apt/lists/*;
|
|
||||||
|
|
||||||
ENV SMTP localhost
|
|
||||||
ENV SMTP_FROM no-reply
|
|
||||||
|
|
||||||
ENV SITENAME "Testsite"
|
|
||||||
|
|
||||||
# Setup SSMTP
|
|
||||||
RUN sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd ;\
|
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd ;\
|
|
||||||
# add possible mail-senders
|
|
||||||
{\
|
|
||||||
echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
|
|
||||||
echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
|
|
||||||
} > /etc/ssmtp/revaliases;\
|
|
||||||
# replace ssmtp.conf settings
|
|
||||||
{\
|
|
||||||
echo "root=$SMTP_FROM@$HOSTNAME" ;\
|
|
||||||
echo "hostname=$HOSTNAME" ;\
|
|
||||||
echo "mailhub=$SMTP" ;\
|
|
||||||
echo "FromLineOverride=YES" ;\
|
|
||||||
[ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" ;\
|
|
||||||
[ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" ;\
|
|
||||||
[ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" ;\
|
|
||||||
[ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" ;\
|
|
||||||
[ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" ;\
|
|
||||||
} > /etc/ssmtp/ssmtp.conf;
|
|
|
@ -1,32 +0,0 @@
|
||||||
FROM friendica/server:fpm-alpine
|
|
||||||
|
|
||||||
RUN set -ex; \
|
|
||||||
apk add --no-cache \
|
|
||||||
# For mail() support
|
|
||||||
ssmtp;
|
|
||||||
|
|
||||||
ENV SMTP localhost
|
|
||||||
ENV SMTP_FROM no-reply
|
|
||||||
|
|
||||||
ENV SITENAME "Testsite"
|
|
||||||
|
|
||||||
# Setup SSMTP
|
|
||||||
RUN sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd ;\
|
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd ;\
|
|
||||||
# add possible mail-senders
|
|
||||||
{\
|
|
||||||
echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
|
|
||||||
echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
|
|
||||||
} > /etc/ssmtp/revaliases;\
|
|
||||||
# replace ssmtp.conf settings
|
|
||||||
{\
|
|
||||||
echo "root=$SMTP_FROM@$HOSTNAME" ;\
|
|
||||||
echo "hostname=$HOSTNAME" ;\
|
|
||||||
echo "mailhub=$SMTP" ;\
|
|
||||||
echo "FromLineOverride=YES" ;\
|
|
||||||
[ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" ;\
|
|
||||||
[ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" ;\
|
|
||||||
[ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" ;\
|
|
||||||
[ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" ;\
|
|
||||||
[ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" ;\
|
|
||||||
} > /etc/ssmtp/ssmtp.conf;
|
|
|
@ -1,37 +0,0 @@
|
||||||
FROM friendica/server:fpm
|
|
||||||
|
|
||||||
# entrypoint.sh and cron.sh dependencies
|
|
||||||
RUN set -ex; \
|
|
||||||
\
|
|
||||||
apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
# For mail() support
|
|
||||||
ssmtp \
|
|
||||||
; \
|
|
||||||
rm -rf /var/lib/apt/lists/*;
|
|
||||||
|
|
||||||
ENV SMTP localhost
|
|
||||||
ENV SMTP_FROM no-reply
|
|
||||||
|
|
||||||
ENV SITENAME "Testsite"
|
|
||||||
|
|
||||||
# Setup SSMTP
|
|
||||||
RUN sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd ;\
|
|
||||||
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd ;\
|
|
||||||
# add possible mail-senders
|
|
||||||
{\
|
|
||||||
echo "www-data:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
|
|
||||||
echo "root:$SMTP_FROM@$HOSTNAME:$SMTP" ;\
|
|
||||||
} > /etc/ssmtp/revaliases;\
|
|
||||||
# replace ssmtp.conf settings
|
|
||||||
{\
|
|
||||||
echo "root=$SMTP_FROM@$HOSTNAME" ;\
|
|
||||||
echo "hostname=$HOSTNAME" ;\
|
|
||||||
echo "mailhub=$SMTP" ;\
|
|
||||||
echo "FromLineOverride=YES" ;\
|
|
||||||
[ -z "$SMTP_TLS" ] || echo "UseTLS=$SMTP_TLS" ;\
|
|
||||||
[ -z "$SMTP_STARTTLS" ] || echo "UseSTARTTLS=$SMTP_STARTTLS" ;\
|
|
||||||
[ -z "$SMTP_AUTH_USER" ] || echo "AuthUser=$SMTP_AUTH_USER" ;\
|
|
||||||
[ -z "$SMTP_AUTH_PASS" ] || echo "AuthPass=$SMTP_AUTH_PASS" ;\
|
|
||||||
[ -z "$SMTP_AUTH_METHOD" ] || echo "AuthMethod=$SMTP_AUTH_METHOD" ;\
|
|
||||||
} > /etc/ssmtp/ssmtp.conf;
|
|
|
@ -10,6 +10,8 @@ RUN set -ex; \
|
||||||
rsync \
|
rsync \
|
||||||
bzip2 \
|
bzip2 \
|
||||||
git \
|
git \
|
||||||
|
# mail() support
|
||||||
|
ssmtp \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
|
@ -119,7 +121,7 @@ RUN set -ex; \
|
||||||
mkdir /usr/src/friendica/addon; \
|
mkdir /usr/src/friendica/addon; \
|
||||||
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
|
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
|
||||||
rm friendica_addons.tar.gz; \
|
rm friendica_addons.tar.gz; \
|
||||||
/usr/src/friendica/bin/composer.phar install --no-plugins --no-scripts --no-dev -d /usr/src/friendica;
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica;
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["apache2-foreground"]
|
CMD ["apache2-foreground"]
|
||||||
|
|
|
@ -15,10 +15,6 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# clones the whole develop branch (Friendica and Addons)
|
# clones the whole develop branch (Friendica and Addons)
|
||||||
clone_develop() {
|
clone_develop() {
|
||||||
friendica_git="${FRIENDICA_VERSION}"
|
friendica_git="${FRIENDICA_VERSION}"
|
||||||
|
@ -43,7 +39,40 @@ clone_develop() {
|
||||||
|
|
||||||
echo "Download finished"
|
echo "Download finished"
|
||||||
|
|
||||||
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_ssmtp() {
|
||||||
|
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
|
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
|
# Setup SSMTP
|
||||||
|
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
|
# add possible mail-senders
|
||||||
|
{
|
||||||
|
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
} > /etc/ssmtp/revaliases;
|
||||||
|
|
||||||
|
# replace ssmtp.conf settings
|
||||||
|
{
|
||||||
|
echo "root=:$smtp_from@$HOSTNAME" ;
|
||||||
|
echo "hostname=$HOSTNAME" ;
|
||||||
|
echo "mailhub=$SMTP" ;
|
||||||
|
echo "FromLineOverride=YES" ;
|
||||||
|
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
|
||||||
|
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
|
||||||
|
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
|
||||||
|
} > /etc/ssmtp/ssmtp.conf
|
||||||
|
|
||||||
|
echo "Setup finished"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# just check if we execute apache or php-fpm
|
# just check if we execute apache or php-fpm
|
||||||
|
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_ssmtp
|
||||||
|
|
||||||
if [ "$check" = true ]; then
|
if [ "$check" = true ]; then
|
||||||
echo "Initializing Friendica $image_version ..."
|
echo "Initializing Friendica $image_version ..."
|
||||||
|
|
||||||
|
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
|
|
||||||
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
||||||
|
|
||||||
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
|
|
||||||
for dir in config; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# In case there is no .htaccess, copy it from the default dist file
|
# In case there is no .htaccess, copy it from the default dist file
|
||||||
if [ ! -f "/var/www/html/.htaccess" ]; then
|
if [ ! -f "/var/www/html/.htaccess" ]; then
|
||||||
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
.htconfig.php
|
.htconfig.php
|
||||||
.htaccess
|
.htaccess
|
||||||
home.*
|
home.*
|
||||||
/config/
|
/config/local.ini.php
|
|
@ -6,7 +6,9 @@ LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
rsync \
|
rsync \
|
||||||
git;
|
git \
|
||||||
|
# mail() support
|
||||||
|
ssmtp;
|
||||||
|
|
||||||
# install the PHP extensions we need
|
# install the PHP extensions we need
|
||||||
# see https://friendi.ca/resources/requirements/
|
# see https://friendi.ca/resources/requirements/
|
||||||
|
@ -102,7 +104,7 @@ RUN set -ex; \
|
||||||
mkdir /usr/src/friendica/addon; \
|
mkdir /usr/src/friendica/addon; \
|
||||||
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
|
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
|
||||||
rm friendica_addons.tar.gz; \
|
rm friendica_addons.tar.gz; \
|
||||||
/usr/src/friendica/bin/composer.phar install --no-plugins --no-scripts --no-dev -d /usr/src/friendica;
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica;
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["php-fpm"]
|
CMD ["php-fpm"]
|
||||||
|
|
|
@ -15,10 +15,6 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# clones the whole develop branch (Friendica and Addons)
|
# clones the whole develop branch (Friendica and Addons)
|
||||||
clone_develop() {
|
clone_develop() {
|
||||||
friendica_git="${FRIENDICA_VERSION}"
|
friendica_git="${FRIENDICA_VERSION}"
|
||||||
|
@ -43,7 +39,40 @@ clone_develop() {
|
||||||
|
|
||||||
echo "Download finished"
|
echo "Download finished"
|
||||||
|
|
||||||
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_ssmtp() {
|
||||||
|
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
|
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
|
# Setup SSMTP
|
||||||
|
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
|
# add possible mail-senders
|
||||||
|
{
|
||||||
|
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
} > /etc/ssmtp/revaliases;
|
||||||
|
|
||||||
|
# replace ssmtp.conf settings
|
||||||
|
{
|
||||||
|
echo "root=:$smtp_from@$HOSTNAME" ;
|
||||||
|
echo "hostname=$HOSTNAME" ;
|
||||||
|
echo "mailhub=$SMTP" ;
|
||||||
|
echo "FromLineOverride=YES" ;
|
||||||
|
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
|
||||||
|
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
|
||||||
|
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
|
||||||
|
} > /etc/ssmtp/ssmtp.conf
|
||||||
|
|
||||||
|
echo "Setup finished"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# just check if we execute apache or php-fpm
|
# just check if we execute apache or php-fpm
|
||||||
|
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_ssmtp
|
||||||
|
|
||||||
if [ "$check" = true ]; then
|
if [ "$check" = true ]; then
|
||||||
echo "Initializing Friendica $image_version ..."
|
echo "Initializing Friendica $image_version ..."
|
||||||
|
|
||||||
|
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
|
|
||||||
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
||||||
|
|
||||||
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
|
|
||||||
for dir in config; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# In case there is no .htaccess, copy it from the default dist file
|
# In case there is no .htaccess, copy it from the default dist file
|
||||||
if [ ! -f "/var/www/html/.htaccess" ]; then
|
if [ ! -f "/var/www/html/.htaccess" ]; then
|
||||||
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
.htconfig.php
|
.htconfig.php
|
||||||
.htaccess
|
.htaccess
|
||||||
home.*
|
home.*
|
||||||
/config/
|
/config/local.ini.php
|
|
@ -10,6 +10,8 @@ RUN set -ex; \
|
||||||
rsync \
|
rsync \
|
||||||
bzip2 \
|
bzip2 \
|
||||||
git \
|
git \
|
||||||
|
# mail() support
|
||||||
|
ssmtp \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
|
@ -111,7 +113,7 @@ RUN set -ex; \
|
||||||
mkdir /usr/src/friendica/addon; \
|
mkdir /usr/src/friendica/addon; \
|
||||||
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
|
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
|
||||||
rm friendica_addons.tar.gz; \
|
rm friendica_addons.tar.gz; \
|
||||||
/usr/src/friendica/bin/composer.phar install --no-plugins --no-scripts --no-dev -d /usr/src/friendica;
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica;
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
CMD ["php-fpm"]
|
CMD ["php-fpm"]
|
||||||
|
|
|
@ -15,10 +15,6 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# clones the whole develop branch (Friendica and Addons)
|
# clones the whole develop branch (Friendica and Addons)
|
||||||
clone_develop() {
|
clone_develop() {
|
||||||
friendica_git="${FRIENDICA_VERSION}"
|
friendica_git="${FRIENDICA_VERSION}"
|
||||||
|
@ -43,7 +39,40 @@ clone_develop() {
|
||||||
|
|
||||||
echo "Download finished"
|
echo "Download finished"
|
||||||
|
|
||||||
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_ssmtp() {
|
||||||
|
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
|
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
|
# Setup SSMTP
|
||||||
|
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
|
# add possible mail-senders
|
||||||
|
{
|
||||||
|
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
} > /etc/ssmtp/revaliases;
|
||||||
|
|
||||||
|
# replace ssmtp.conf settings
|
||||||
|
{
|
||||||
|
echo "root=:$smtp_from@$HOSTNAME" ;
|
||||||
|
echo "hostname=$HOSTNAME" ;
|
||||||
|
echo "mailhub=$SMTP" ;
|
||||||
|
echo "FromLineOverride=YES" ;
|
||||||
|
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
|
||||||
|
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
|
||||||
|
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
|
||||||
|
} > /etc/ssmtp/ssmtp.conf
|
||||||
|
|
||||||
|
echo "Setup finished"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# just check if we execute apache or php-fpm
|
# just check if we execute apache or php-fpm
|
||||||
|
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_ssmtp
|
||||||
|
|
||||||
if [ "$check" = true ]; then
|
if [ "$check" = true ]; then
|
||||||
echo "Initializing Friendica $image_version ..."
|
echo "Initializing Friendica $image_version ..."
|
||||||
|
|
||||||
|
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
|
|
||||||
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
||||||
|
|
||||||
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
|
|
||||||
for dir in config; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# In case there is no .htaccess, copy it from the default dist file
|
# In case there is no .htaccess, copy it from the default dist file
|
||||||
if [ ! -f "/var/www/html/.htaccess" ]; then
|
if [ ! -f "/var/www/html/.htaccess" ]; then
|
||||||
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
.htconfig.php
|
.htconfig.php
|
||||||
.htaccess
|
.htaccess
|
||||||
home.*
|
home.*
|
||||||
/config/
|
/config/local.ini.php
|
|
@ -10,6 +10,8 @@ RUN set -ex; \
|
||||||
rsync \
|
rsync \
|
||||||
bzip2 \
|
bzip2 \
|
||||||
git \
|
git \
|
||||||
|
# mail() support
|
||||||
|
ssmtp \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,6 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# clones the whole develop branch (Friendica and Addons)
|
# clones the whole develop branch (Friendica and Addons)
|
||||||
clone_develop() {
|
clone_develop() {
|
||||||
friendica_git="${FRIENDICA_VERSION}"
|
friendica_git="${FRIENDICA_VERSION}"
|
||||||
|
@ -43,7 +39,40 @@ clone_develop() {
|
||||||
|
|
||||||
echo "Download finished"
|
echo "Download finished"
|
||||||
|
|
||||||
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_ssmtp() {
|
||||||
|
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
|
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
|
# Setup SSMTP
|
||||||
|
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
|
# add possible mail-senders
|
||||||
|
{
|
||||||
|
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
} > /etc/ssmtp/revaliases;
|
||||||
|
|
||||||
|
# replace ssmtp.conf settings
|
||||||
|
{
|
||||||
|
echo "root=:$smtp_from@$HOSTNAME" ;
|
||||||
|
echo "hostname=$HOSTNAME" ;
|
||||||
|
echo "mailhub=$SMTP" ;
|
||||||
|
echo "FromLineOverride=YES" ;
|
||||||
|
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
|
||||||
|
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
|
||||||
|
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
|
||||||
|
} > /etc/ssmtp/ssmtp.conf
|
||||||
|
|
||||||
|
echo "Setup finished"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# just check if we execute apache or php-fpm
|
# just check if we execute apache or php-fpm
|
||||||
|
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_ssmtp
|
||||||
|
|
||||||
if [ "$check" = true ]; then
|
if [ "$check" = true ]; then
|
||||||
echo "Initializing Friendica $image_version ..."
|
echo "Initializing Friendica $image_version ..."
|
||||||
|
|
||||||
|
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
|
|
||||||
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
||||||
|
|
||||||
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
|
|
||||||
for dir in config; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# In case there is no .htaccess, copy it from the default dist file
|
# In case there is no .htaccess, copy it from the default dist file
|
||||||
if [ ! -f "/var/www/html/.htaccess" ]; then
|
if [ ! -f "/var/www/html/.htaccess" ]; then
|
||||||
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
.htconfig.php
|
.htconfig.php
|
||||||
.htaccess
|
.htaccess
|
||||||
home.*
|
home.*
|
||||||
/config/
|
/config/local.ini.php
|
|
@ -6,7 +6,9 @@ LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
rsync \
|
rsync \
|
||||||
git;
|
git \
|
||||||
|
# mail() support
|
||||||
|
ssmtp;
|
||||||
|
|
||||||
# install the PHP extensions we need
|
# install the PHP extensions we need
|
||||||
# see https://friendi.ca/resources/requirements/
|
# see https://friendi.ca/resources/requirements/
|
||||||
|
|
|
@ -15,10 +15,6 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# clones the whole develop branch (Friendica and Addons)
|
# clones the whole develop branch (Friendica and Addons)
|
||||||
clone_develop() {
|
clone_develop() {
|
||||||
friendica_git="${FRIENDICA_VERSION}"
|
friendica_git="${FRIENDICA_VERSION}"
|
||||||
|
@ -43,7 +39,40 @@ clone_develop() {
|
||||||
|
|
||||||
echo "Download finished"
|
echo "Download finished"
|
||||||
|
|
||||||
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_ssmtp() {
|
||||||
|
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
|
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
|
# Setup SSMTP
|
||||||
|
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
|
# add possible mail-senders
|
||||||
|
{
|
||||||
|
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
} > /etc/ssmtp/revaliases;
|
||||||
|
|
||||||
|
# replace ssmtp.conf settings
|
||||||
|
{
|
||||||
|
echo "root=:$smtp_from@$HOSTNAME" ;
|
||||||
|
echo "hostname=$HOSTNAME" ;
|
||||||
|
echo "mailhub=$SMTP" ;
|
||||||
|
echo "FromLineOverride=YES" ;
|
||||||
|
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
|
||||||
|
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
|
||||||
|
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
|
||||||
|
} > /etc/ssmtp/ssmtp.conf
|
||||||
|
|
||||||
|
echo "Setup finished"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# just check if we execute apache or php-fpm
|
# just check if we execute apache or php-fpm
|
||||||
|
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_ssmtp
|
||||||
|
|
||||||
if [ "$check" = true ]; then
|
if [ "$check" = true ]; then
|
||||||
echo "Initializing Friendica $image_version ..."
|
echo "Initializing Friendica $image_version ..."
|
||||||
|
|
||||||
|
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
|
|
||||||
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
||||||
|
|
||||||
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
|
|
||||||
for dir in config; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# In case there is no .htaccess, copy it from the default dist file
|
# In case there is no .htaccess, copy it from the default dist file
|
||||||
if [ ! -f "/var/www/html/.htaccess" ]; then
|
if [ ! -f "/var/www/html/.htaccess" ]; then
|
||||||
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
.htconfig.php
|
.htconfig.php
|
||||||
.htaccess
|
.htaccess
|
||||||
home.*
|
home.*
|
||||||
/config/
|
/config/local.ini.php
|
|
@ -10,6 +10,8 @@ RUN set -ex; \
|
||||||
rsync \
|
rsync \
|
||||||
bzip2 \
|
bzip2 \
|
||||||
git \
|
git \
|
||||||
|
# mail() support
|
||||||
|
ssmtp \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,6 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# clones the whole develop branch (Friendica and Addons)
|
# clones the whole develop branch (Friendica and Addons)
|
||||||
clone_develop() {
|
clone_develop() {
|
||||||
friendica_git="${FRIENDICA_VERSION}"
|
friendica_git="${FRIENDICA_VERSION}"
|
||||||
|
@ -43,7 +39,40 @@ clone_develop() {
|
||||||
|
|
||||||
echo "Download finished"
|
echo "Download finished"
|
||||||
|
|
||||||
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_ssmtp() {
|
||||||
|
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
|
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
|
# Setup SSMTP
|
||||||
|
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
|
# add possible mail-senders
|
||||||
|
{
|
||||||
|
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
} > /etc/ssmtp/revaliases;
|
||||||
|
|
||||||
|
# replace ssmtp.conf settings
|
||||||
|
{
|
||||||
|
echo "root=:$smtp_from@$HOSTNAME" ;
|
||||||
|
echo "hostname=$HOSTNAME" ;
|
||||||
|
echo "mailhub=$SMTP" ;
|
||||||
|
echo "FromLineOverride=YES" ;
|
||||||
|
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
|
||||||
|
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
|
||||||
|
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
|
||||||
|
} > /etc/ssmtp/ssmtp.conf
|
||||||
|
|
||||||
|
echo "Setup finished"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# just check if we execute apache or php-fpm
|
# just check if we execute apache or php-fpm
|
||||||
|
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_ssmtp
|
||||||
|
|
||||||
if [ "$check" = true ]; then
|
if [ "$check" = true ]; then
|
||||||
echo "Initializing Friendica $image_version ..."
|
echo "Initializing Friendica $image_version ..."
|
||||||
|
|
||||||
|
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
|
|
||||||
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
||||||
|
|
||||||
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
|
|
||||||
for dir in config; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# In case there is no .htaccess, copy it from the default dist file
|
# In case there is no .htaccess, copy it from the default dist file
|
||||||
if [ ! -f "/var/www/html/.htaccess" ]; then
|
if [ ! -f "/var/www/html/.htaccess" ]; then
|
||||||
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
.htconfig.php
|
.htconfig.php
|
||||||
.htaccess
|
.htaccess
|
||||||
home.*
|
home.*
|
||||||
/config/
|
/config/local.ini.php
|
|
@ -5,7 +5,9 @@ LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
rsync \
|
rsync \
|
||||||
git;
|
git \
|
||||||
|
# mail() support
|
||||||
|
ssmtp;
|
||||||
|
|
||||||
# install the PHP extensions we need
|
# install the PHP extensions we need
|
||||||
# see https://friendi.ca/resources/requirements/
|
# see https://friendi.ca/resources/requirements/
|
||||||
|
|
|
@ -9,6 +9,8 @@ RUN set -ex; \
|
||||||
rsync \
|
rsync \
|
||||||
bzip2 \
|
bzip2 \
|
||||||
git \
|
git \
|
||||||
|
# mail() support
|
||||||
|
ssmtp \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
|
|
18
README.md
18
README.md
|
@ -89,7 +89,23 @@ Because Friendica links the administrator account to a specific mail address, yo
|
||||||
|
|
||||||
## Mail settings
|
## Mail settings
|
||||||
|
|
||||||
see the [example](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/README.md#smtpsetting)
|
The binary `ssmtp` is used for the `mail()` support of Friendica.
|
||||||
|
|
||||||
|
You have to set the `--hostname/-h` parameter correctly to use the right domainname for the `mail()` command.
|
||||||
|
|
||||||
|
You have to set a valid SMTP-MTA for the `SMTP` environment variable to enable mail support in Friendica.
|
||||||
|
A valid SMTP-MTA would be, for example, `mx.example.org`.
|
||||||
|
|
||||||
|
The following environment variables are possible for the SMTP examples.
|
||||||
|
|
||||||
|
- `SITENAME` The name of the Friendica node. (**required**)
|
||||||
|
- `SMTP` Address of the SMTP Mail-Gateway. (**required**)
|
||||||
|
- `SMTP_FROM` Sender user-part of the address. (Default: `no-reply` - e.g. no-reply@friendica.local)
|
||||||
|
- `SMTP_TLS` Use TLS for connecting the SMTP Mail-Gateway. (Default: empty)
|
||||||
|
- `SMTP_STARTTLS` Use STARTTLS for connecting the SMTP Mail-Gateway. (Default: empty)
|
||||||
|
- `SMTP_AUTH_USER` Username for the SMTP Mail-Gateway. (Default: empty)
|
||||||
|
- `SMTP_AUTH_PASS` Password for the SMTP Mail-Gateway. (Default: empty)
|
||||||
|
- `SMTP_AUTH_METHOD` Authentication method for the SMTP Mail-Gateway. (Default: empty/plain text)
|
||||||
|
|
||||||
## Database settings
|
## Database settings
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,6 @@ version_greater() {
|
||||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
directory_empty() {
|
|
||||||
[ -z "$(ls -A "$1/")" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# clones the whole develop branch (Friendica and Addons)
|
# clones the whole develop branch (Friendica and Addons)
|
||||||
clone_develop() {
|
clone_develop() {
|
||||||
friendica_git="${FRIENDICA_VERSION}"
|
friendica_git="${FRIENDICA_VERSION}"
|
||||||
|
@ -43,7 +39,40 @@ clone_develop() {
|
||||||
|
|
||||||
echo "Download finished"
|
echo "Download finished"
|
||||||
|
|
||||||
/usr/src/friendica/bin/composer.phar install --no-dev --no-plugins --no-scripts -d /usr/src/friendica
|
/usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_ssmtp() {
|
||||||
|
if [ -n "${SITENAME+x}" ] && [ -n "${SMTP+x}" ] && [ "${SMTP}" != "localhost" ]; then
|
||||||
|
echo "Setup SSMTP for '$SITENAME' with '$SMTP' ..."
|
||||||
|
|
||||||
|
smtp_from=${SMTP_FROM:-no-reply}
|
||||||
|
|
||||||
|
# Setup SSMTP
|
||||||
|
sed -i "s/:root:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
sed -i "s/:Linux\ User:/:${SITENAME}:/g" /etc/passwd
|
||||||
|
|
||||||
|
# add possible mail-senders
|
||||||
|
{
|
||||||
|
echo "www-data:$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
echo "root::$smtp_from@$HOSTNAME:$SMTP" ;
|
||||||
|
} > /etc/ssmtp/revaliases;
|
||||||
|
|
||||||
|
# replace ssmtp.conf settings
|
||||||
|
{
|
||||||
|
echo "root=:$smtp_from@$HOSTNAME" ;
|
||||||
|
echo "hostname=$HOSTNAME" ;
|
||||||
|
echo "mailhub=$SMTP" ;
|
||||||
|
echo "FromLineOverride=YES" ;
|
||||||
|
if [ -n "${SMTP_TLS+x}" ]; then echo "UseTLS=$SMTP_TLS"; fi
|
||||||
|
if [ -n "${SMTP_STARTTLS+x}" ]; then echo "UseSTARTTLS=$SMTP_STARTTLS"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_USER+x}" ]; then echo "AuthUser=$SMTP_AUTH_USER"; fi
|
||||||
|
if [ -n "${SMTP_AUTH_PASS+x}" ]; then echo "AuthPass=$SMTP_AUTH_PASS";fi
|
||||||
|
if [ -n "${SMTP_AUTH_METHOD+x}" ]; then echo "AuthMethod=$SMTP_AUTH_METHOD"; fi
|
||||||
|
} > /etc/ssmtp/ssmtp.conf
|
||||||
|
|
||||||
|
echo "Setup finished"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# just check if we execute apache or php-fpm
|
# just check if we execute apache or php-fpm
|
||||||
|
@ -77,6 +106,8 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_ssmtp
|
||||||
|
|
||||||
if [ "$check" = true ]; then
|
if [ "$check" = true ]; then
|
||||||
echo "Initializing Friendica $image_version ..."
|
echo "Initializing Friendica $image_version ..."
|
||||||
|
|
||||||
|
@ -92,13 +123,6 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
||||||
|
|
||||||
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/friendica/ /var/www/html/
|
||||||
|
|
||||||
# copy every *.ini.php from the config directory except they are already copied (in case of an upgrade)
|
|
||||||
for dir in config; do
|
|
||||||
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
|
|
||||||
rsync $rsync_options --include="/$dir/" --exclude="/*" /usr/src/friendica/ /var/www/html/
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# In case there is no .htaccess, copy it from the default dist file
|
# In case there is no .htaccess, copy it from the default dist file
|
||||||
if [ ! -f "/var/www/html/.htaccess" ]; then
|
if [ ! -f "/var/www/html/.htaccess" ]; then
|
||||||
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
cp "/var/www/html/.htaccess-dist" "/var/www/html/.htaccess"
|
||||||
|
|
|
@ -30,7 +30,7 @@ declare -A pecl_versions=(
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -A install_extras=(
|
declare -A install_extras=(
|
||||||
['stable']='\nRUN set -ex; \\\n curl -fsSL -o friendica.tar.gz \\\n "https://github.com/friendica/friendica/archive/${FRIENDICA_VERSION}.tar.gz"; \\\n tar -xzf friendica.tar.gz -C /usr/src/; \\\n rm friendica.tar.gz; \\\n mv -f /usr/src/friendica-${FRIENDICA_VERSION}/ /usr/src/friendica; \\\n chmod 777 /usr/src/friendica/view/smarty3; \\\n curl -fsSL -o friendica_addons.tar.gz \\\n "https://github.com/friendica/friendica-addons/archive/${FRIENDICA_ADDONS}.tar.gz"; \\\n mkdir /usr/src/friendica/addon; \\\n tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \\\n rm friendica_addons.tar.gz; \\\n /usr/src/friendica/bin/composer.phar install --no-plugins --no-scripts --no-dev -d /usr/src/friendica;'
|
['stable']='\nRUN set -ex; \\\n curl -fsSL -o friendica.tar.gz \\\n "https://github.com/friendica/friendica/archive/${FRIENDICA_VERSION}.tar.gz"; \\\n tar -xzf friendica.tar.gz -C /usr/src/; \\\n rm friendica.tar.gz; \\\n mv -f /usr/src/friendica-${FRIENDICA_VERSION}/ /usr/src/friendica; \\\n chmod 777 /usr/src/friendica/view/smarty3; \\\n curl -fsSL -o friendica_addons.tar.gz \\\n "https://github.com/friendica/friendica-addons/archive/${FRIENDICA_ADDONS}.tar.gz"; \\\n mkdir /usr/src/friendica/addon; \\\n tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \\\n rm friendica_addons.tar.gz; \\\n /usr/src/friendica/bin/composer.phar install --no-dev -d /usr/src/friendica;'
|
||||||
['develop']=''
|
['develop']=''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
.htconfig.php
|
.htconfig.php
|
||||||
.htaccess
|
.htaccess
|
||||||
home.*
|
home.*
|
||||||
/config/
|
/config/local.ini.php
|
Loading…
Reference in a new issue