diff --git a/Dockerfile b/Dockerfile index 501da38..bb8e19f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,13 +7,30 @@ ENV COPS_VER="1.0.0" # install runtime packages RUN \ apk add --no-cache \ - curl \ php5-dom \ php5-gd \ php5-intl \ php5-openssl \ - php5-pdo_sqlite \ - tar + php5-pdo_sqlite + +# install cops +RUN \ + apk add --no-cache --virtual=build-dependencies \ + curl \ + tar && \ + curl -o \ + /tmp/cops.tar.gz -L \ + "https://github.com/seblucas/cops/archive/${COPS_VER}.tar.gz" && \ + mkdir -p \ + /usr/share/webapps/cops && \ + tar xf /tmp/cops.tar.gz -C \ + /usr/share/webapps/cops --strip-components=1 && \ + +# cleanup + apk del --purge \ + build-dependencies && \ + rm -rf \ + /tmp/* # add local files COPY root/ / diff --git a/root/defaults/config_local.php b/root/defaults/config_local.php index d2c213f..aa801bf 100644 --- a/root/defaults/config_local.php +++ b/root/defaults/config_local.php @@ -41,7 +41,7 @@ * 0 : disable */ - $config['cops_mail_configuration'] = array( "smtp.host" => "", + $config['cops_mail_configuration'] = array( "smtp.host" => "smtp.gmail.com", "smtp.username" => "", "smtp.password" => "", "smtp.secure" => "ssl", diff --git a/root/defaults/default b/root/defaults/default index a49cb42..7b17379 100644 --- a/root/defaults/default +++ b/root/defaults/default @@ -1,18 +1,13 @@ server { listen 80 default_server; - - listen 443 ssl; - + listen 443 ssl; server_name _; - - ssl_certificate /config/keys/cert.crt; + ssl_certificate /config/keys/cert.crt; ssl_certificate_key /config/keys/cert.key; - access_log /config/log/nginx/access.log; error_log /config/log/nginx/error.log; - - root /config/www/cops; + root /var/www/localhost/cops; index index.php; #Useful only for Kobo reader diff --git a/root/etc/cont-init.d/40-config b/root/etc/cont-init.d/40-config new file mode 100644 index 0000000..a0ded90 --- /dev/null +++ b/root/etc/cont-init.d/40-config @@ -0,0 +1,16 @@ +#!/usr/bin/with-contenv bash + +# make symlink +[[ ! -e /var/www/localhost/cops ]] && \ + ln -s /usr/share/webapps/cops /var/www/localhost/cops + +# copy config +[[ ! -e /config/config_local.php ]] && \ + cp /defaults/config_local.php /config/config_local.php +cp /config/config_local.php /var/www/localhost/cops/ + +# permissions +chown -R abc:abc \ + /config \ + /usr/share/webapps/cops \ + var/www/localhost/cops diff --git a/root/etc/cont-init.d/40-install b/root/etc/cont-init.d/40-install deleted file mode 100644 index b670a24..0000000 --- a/root/etc/cont-init.d/40-install +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/with-contenv bash - -# install cops -if [ ! -e "/config/www/cops/index.php" ]; then -curl -o \ - /tmp/cops.tar.gz -L \ - "https://github.com/seblucas/cops/archive/${COPS_VER}.tar.gz" -mkdir -p \ - /config/www/cops -tar xf /tmp/cops.tar.gz -C \ - /config/www/cops --strip-components=1 -fi - -# copy config -[[ ! -e /config/www/cops/config_local.php ]] && \ - cp /defaults/config_local.php /config/www/cops/config_local.php - -# permissions -chown -R abc:abc \ - /config/www