From c702822330f60dda2147fbd768263b095eb0b496 Mon Sep 17 00:00:00 2001 From: Jeroen Geusebroek Date: Fri, 29 Jan 2016 14:13:24 +0100 Subject: [PATCH] Several changes for public release. --- .gitignore | 2 +- Dockerfile | 9 ++++----- README.md | 45 +++++++++++++++++++++++++++++++++++++++++---- build.sh | 3 ++- buildNoCache.sh | 1 + entrypoint.sh | 24 +++++++----------------- 6 files changed, 56 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index a084c4d..f6a0782 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,4 @@ # Linux *~ .directory -.Trash-* +.Trash-* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3a5c490..c2e8a87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ MAINTAINER Jeroen Geusebroek ENV DEBIAN_FRONTEND="noninteractive" \ TERM="xterm" \ - APTLIST="apache2 php5 php5-curl php5-gd php5-gmp php5-mysql git-core sudo cron" \ - REFRESHED_AT='2015-01-18' + APTLIST="apache2 php5 php5-curl php5-gd php5-gmp php5-mysql git-core" \ + REFRESHED_AT='2015-01-29' RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup &&\ echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache && \ @@ -19,9 +19,8 @@ RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup &&\ rm -r /var/www/html && \ rm -rf /tmp/* -RUN git clone https://github.com/spotweb/spotweb.git /var/www/spotweb && \ - cd /var/www/spotweb && \ - git checkout media && \ +RUN git clone -b media --single-branch https://github.com/spotweb/spotweb.git /var/www/spotweb && \ + rm -rf /var/www/spotweb/.git && \ chmod -R 775 /var/www/spotweb && \ chown -R www-data:www-data /var/www/spotweb diff --git a/README.md b/README.md index e8df47f..fe17b8f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,48 @@ -# Docker spotweb +[![](https://badge.imagelayers.io/jgeusebroek/spotweb:latest.svg)](https://imagelayers.io/?images=jgeusebroek/spotweb:latest 'Get your own badge on imagelayers.io') + +# Docker Spotweb image + +An image running [ubuntu/15.10](https://github.com/gliderlabs/docker-alpine) Linux and [Spotweb](https://github.com/spotweb/spotweb) (media branch). + +This image was mainly for own use, but it seems to be populair so I decided to provide some documentation. + +## MySQL + +You need a seperate MySQL / MariaDB server. This can be a ofcourse be a (linked) docker container but also a dedicated database server. + +## Updates + +The container will try to auto-update the database when a newer version image is released. + +## Usage + docker run --restart=always -d -p 80:80 \ --hostname=spotweb \ --name=spotweb \ - -v /config:/config \ + -v :/config \ + -e TZ='Europe/Amsterdam' -e SPOTWEB_DB_TYPE=pdo_mysql \ - -e SPOTWEB_DB_HOST= \ + -e SPOTWEB_DB_HOST= \ -e SPOTWEB_DB_NAME=spotweb \ -e SPOTWEB_DB_USER=spotweb \ -e SPOTWEB_DB_PASS=spotweb \ - jgeusebroek/spotweb \ No newline at end of file + jgeusebroek/spotweb + +You should now be able to reach the spotweb interface on port 80, and you can configure Spotweb. + +## Environment variables + +* `TZ` The timezone the server is running in. Defaults to `Europe/Amsterdam`. +* `SPOTWEB_DB_TYPE` Database type. Use `pdo_mysql` for MySQL. +* `SPOTWEB_DB_HOST` The hostname / IP of the database server. +* `SPOTWEB_DB_NAME` The database used for spotweb. +* `SPOTWEB_DB_USER` The database server username. +* `SPOTWEB_DB_PASS` The database server password. + +## License + +MIT / BSD + +## Author Information + +[Jeroen Geusebroek](https://jeroengeusebroek.nl/) \ No newline at end of file diff --git a/build.sh b/build.sh index 859ffb7..814719a 100755 --- a/build.sh +++ b/build.sh @@ -1,2 +1,3 @@ #!/usr/bin/env bash -docker build --rm -t jgeusebroek/spotweb . + +docker build --rm -t jgeusebroek/spotweb . \ No newline at end of file diff --git a/buildNoCache.sh b/buildNoCache.sh index 331e6b5..308ddaf 100755 --- a/buildNoCache.sh +++ b/buildNoCache.sh @@ -1,2 +1,3 @@ #!/usr/bin/env bash + docker build --rm --pull --no-cache -t jgeusebroek/spotweb . \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 19e8eb8..6ce28a6 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,16 +1,10 @@ #!/bin/bash -set -x - -SPOTWEB_CRON=${SPOTWEB_CRON:-'*/15 * * * *'} if [ ! -f /config/ownsettings.php ] && [ -f /var/www/spotweb/ownsettings.php ]; then cp /var/www/spotweb/ownsettings.php /config/ownsettings.php - -elif [ ! -f /config/ownsettings.php ] && [ ! -f /var/www/spotweb/ownsettings.php ]; then - touch /config/ownsettings.php fi -chown www-data:www-data /config/ownsettings.php +touch /config/ownsettings.php && chown www-data:www-data /config/ownsettings.php rm -f /var/www/spotweb/ownsettings.php ln -s /config/ownsettings.php /var/www/spotweb/ownsettings.php @@ -32,18 +26,14 @@ if [ -f /config/dbsettings.inc.php ]; then # Run database update /usr/bin/php /var/www/spotweb/upgrade-db.php else - echo "WARNING: You have no database configuration file, either create /config/dbsettings.inc.php or restart this container with the correct environment variables to auto generate the config." + echo -e "\nWARNING: You have no database configuration file, either create /config/dbsettings.inc.php or restart this container with the correct environment variables to auto generate the config.\n" fi -echo "Updating PHP time zone" -TIMEZONE=${TIMEZONE:-"Europe/Amsterdam"} -sed -i "s#^;date.timezone =.*#date.timezone = ${TIMEZONE}#g" /etc/php5/*/php.ini +TZ=${TZ:-"Europe/Amsterdam"} +echo -e "Setting (PHP) time zone to ${TZ}\n" +sed -i "s#^;date.timezone =.*#date.timezone = ${TZ}#g" /etc/php5/*/php.ini -echo "Enabling PHP mod rewrite" -/usr/sbin/a2enmod rewrite +# Enabling PHP mod rewrite +/usr/sbin/a2enmod rewrite && /etc/init.d/apache2 restart -echo "Updating hourly cron" -(crontab -l ; echo "${SPOTWEB_CRON} /usr/bin/php /var/www/spotweb/retrieve.php | tee /var/log/spotweb-retrieve.log") | crontab - - -/etc/init.d/apache2 restart tail -F /var/log/apache2/* \ No newline at end of file