docker: build fixes

This commit is contained in:
nacho 2018-09-20 21:56:23 -06:00
parent 9ee428280a
commit 7a8c0e40f5
8 changed files with 27 additions and 10 deletions

View File

@ -1,5 +1,9 @@
[v0.59.17](https://github.com/nextcloud/nextcloudpi/commit/620be82) (2018-09-09) docker: fix letsencrypt not persistent
[v0.59.18](https://github.com/nextcloud/nextcloudpi/commit/fb7164e) (2018-09-20) docker: build fixes
[v0.59.17](https://github.com/nextcloud/nextcloudpi/commit/9ee4282) (2018-09-09) docker: fix letsencrypt not persistent
[v0.59.16](https://github.com/nextcloud/nextcloudpi/commit/7443425) (2018-09-09) docker: allow domains in command line, not only IPs
[v0.59.15](https://github.com/nextcloud/nextcloudpi/commit/41f21fa) (2018-09-17) Don't overwrite an existing mail_smtpmode, if it is not "PHP"

View File

@ -24,6 +24,9 @@ activate_script /nc-nextcloud.sh; \
mv /var/www/nextcloud /data-ro/app; \
ln -s /data-ro/app /var/www/nextcloud; \
# stop mysqld
mysqladmin -u root shutdown; \
# package cleanup
apt-get autoremove -y; \
apt-get clean; \

View File

@ -45,6 +45,7 @@ for script in *.sh; do cleanup_script $script; done; \
apt-get autoremove -y; \
apt-get clean; \
rm -f /var/lib/apt/lists/*; \
find /var/log -type f -exec rm {} \; ; \
rm -rf /usr/share/man/*; \
rm -rf /usr/share/doc/*; \
rm -f /var/log/alternatives.log /var/log/apt/*; \

View File

@ -4,9 +4,6 @@ source /usr/local/etc/library.sh
set -e
NCDIR=/var/www/nextcloud
OCC="$NCDIR/occ"
[[ "$1" == "stop" ]] && {
echo "stopping Cron..."
killall cron
@ -24,6 +21,7 @@ rm /var/www/nextcloud
ln -s /data/app /var/www/nextcloud
echo "Provisioning"
DB_PID="$( pidof mysqld )"
bash /usr/local/bin/ncp-provisioning.sh
echo "Starting Redis"
@ -37,10 +35,16 @@ cron
echo "Starting Postfix"
postfix start
# INIT DATABASE AND NEXTCLOUD CONFIG (first run)
test -f /data/app/config/config.php || {
echo "Uninitialized instance, running nc-init..."
# mariaDB is restarted in the backgroud during provisioning
while kill -0 "$DB_PID" 2>/dev/null; do sleep 0.5; done
while :; do
[[ -S /run/mysqld/mysqld.sock ]] && break
sleep 0.5
done
source /usr/local/etc/library.sh
activate_script /nc-init.sh
mv /index.php /var/www/nextcloud/ # restore this file after init
@ -49,11 +53,11 @@ test -f /data/app/config/config.php || {
# Trusted Domain ( local IP )
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )
IP=$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )
sudo -u www-data php "$OCC" config:system:set trusted_domains 1 --value="$IP"
ncc config:system:set trusted_domains 1 --value="$IP"
# Trusted Domain ( as an argument )
[[ "$@" != "" ]] && \
sudo -u www-data php "$OCC" config:system:set trusted_domains 6 --value="$@"
[[ "$2" != "" ]] && \
ncc config:system:set trusted_domains 6 --value="$2"
# Display NC logs in the docker logs
tail -f -n0 /data/app/data/nextcloud.log &

View File

@ -24,6 +24,9 @@ activate_script /nc-nextcloud.sh; \
mv /var/www/nextcloud /data-ro/app; \
ln -s /data-ro/app /var/www/nextcloud; \
# stop mysqld
mysqladmin -u root shutdown; \
# package cleanup
apt-get autoremove -y; \
apt-get clean; \

View File

@ -45,6 +45,7 @@ for script in *.sh; do cleanup_script $script; done; \
apt-get autoremove -y; \
apt-get clean; \
rm -f /var/lib/apt/lists/*; \
find /var/log -type f -exec rm {} \; ; \
rm -rf /usr/share/man/*; \
rm -rf /usr/share/doc/*; \
rm -f /var/log/alternatives.log /var/log/apt/*; \

View File

@ -62,7 +62,7 @@ configure()
[[ "$REDISMEM_" == "0" ]] && REDISMEM_=$AUTOMEM && echo "Using ${AUTOMEM}B for Redis"
[[ "$REDISMEM_" != "$CURRENT_REDIS_MEM" ]] && {
sed -i "s|maxmemory .*|maxmemory $REDISMEM_|" "$CONF"
service redis restart
service redis-server restart
}
}

3
ncp.sh
View File

@ -216,7 +216,8 @@ EOF
sed -i '$c127.0.1.1 nextcloudpi' /etc/hosts
## tag image
echo "NextCloudPi_$( date "+%m-%d-%y" )" > /usr/local/etc/ncp-baseimage
[[ -f /.docker-image ]] && local DOCKER_TAG="_docker"
echo "NextCloudPi${DOCKER_TAG}_$( date "+%m-%d-%y" )" > /usr/local/etc/ncp-baseimage
## SSH hardening
if [[ -f /etc/ssh/sshd_config ]]; then