diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-07-02 22:35:54 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-07-02 22:35:54 -0400 |
commit | 4b5c3b05271a63cb7b2790ffa9a81453fef5b642 (patch) | |
tree | de0fb4b380d4882826dff7caae49114ce0a330ab | |
parent | 9bc82296a93c348c376a7db472be1612f1785c3f (diff) |
Use PHP7 for Docker image
-rw-r--r-- | .docker/crontab/cronjob.alpine | 1 | ||||
-rw-r--r-- | .docker/crontab/cronjob.debian | 1 | ||||
-rw-r--r-- | .docker/kanboard/config.php | 3 | ||||
-rw-r--r-- | .docker/nginx/nginx.conf | 72 | ||||
-rw-r--r-- | .docker/php/conf.d/local.ini | 16 | ||||
-rw-r--r-- | .docker/php/php-fpm.conf | 22 | ||||
-rwxr-xr-x | .docker/services.d/.s6-svscan/finish | 2 | ||||
-rwxr-xr-x | .docker/services.d/nginx/run | 2 | ||||
-rwxr-xr-x | .docker/services.d/php/run | 2 | ||||
-rw-r--r-- | .dockerignore | 18 | ||||
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | Dockerfile | 37 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | app/constants.php | 2 | ||||
-rw-r--r-- | doc/docker.markdown | 6 | ||||
-rw-r--r-- | doc/env.markdown | 1 | ||||
-rw-r--r-- | docker/crontab/cronjob.alpine | 1 | ||||
-rw-r--r-- | docker/php/env.conf | 2 | ||||
-rwxr-xr-x | docker/services.d/cron/run (renamed from .docker/services.d/cron/run) | 0 |
19 files changed, 34 insertions, 158 deletions
diff --git a/.docker/crontab/cronjob.alpine b/.docker/crontab/cronjob.alpine deleted file mode 100644 index 91ad044e..00000000 --- a/.docker/crontab/cronjob.alpine +++ /dev/null @@ -1 +0,0 @@ -1 0 * * * cd /var/www/kanboard && ./kanboard cronjob >/dev/null 2>&1 diff --git a/.docker/crontab/cronjob.debian b/.docker/crontab/cronjob.debian deleted file mode 100644 index 40310d4f..00000000 --- a/.docker/crontab/cronjob.debian +++ /dev/null @@ -1 +0,0 @@ -@daily www-data cd /var/www/html/kanboard && ./kanboard cronjob >/dev/null 2>&1 diff --git a/.docker/kanboard/config.php b/.docker/kanboard/config.php deleted file mode 100644 index fa1c5971..00000000 --- a/.docker/kanboard/config.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -define('ENABLE_URL_REWRITE', true); diff --git a/.docker/nginx/nginx.conf b/.docker/nginx/nginx.conf deleted file mode 100644 index a04fce74..00000000 --- a/.docker/nginx/nginx.conf +++ /dev/null @@ -1,72 +0,0 @@ -user nginx; -worker_processes 1; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include mime.types; - default_type application/octet-stream; - - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 65; - server_tokens off; - access_log off; - error_log /dev/stderr; - - server { - listen 80; - server_name localhost; - index index.php; - root /var/www/kanboard; - - location / { - try_files $uri $uri/ /index.php$is_args$args; - } - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php-fpm.sock; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_index index.php; - include fastcgi_params; - } - - location /data { - return 404; - } - - location ~* ^.+\.(log|sqlite)$ { - return 404; - } - - location ~ /\.ht { - return 404; - } - - location ~* ^.+\.(ico|jpg|gif|png|css|js|svg|eot|ttf|woff|woff2|otf)$ { - expires 7d; - etag on; - } - - client_max_body_size 32M; - gzip on; - gzip_comp_level 3; - gzip_disable "msie6"; - gzip_vary on; - gzip_types - text/javascript - application/javascript - application/json - text/xml - application/xml - application/rss+xml - text/css - text/plain; - } -} diff --git a/.docker/php/conf.d/local.ini b/.docker/php/conf.d/local.ini deleted file mode 100644 index 3660bed8..00000000 --- a/.docker/php/conf.d/local.ini +++ /dev/null @@ -1,16 +0,0 @@ -expose_php = Off -error_reporting = E_ALL -display_errors = Off -log_errors = On -error_log = /dev/stderr -date.timezone = UTC -allow_url_fopen = On -post_max_size = 30M -upload_max_filesize = 30M -opcache.max_accelerated_files = 7963 -opcache.validate_timestamps = Off -opcache.save_comments = 0 -opcache.load_comments = 0 -opcache.fast_shutdown = 1 -opcache.enable_file_override = On -always_populate_raw_post_data = -1
\ No newline at end of file diff --git a/.docker/php/php-fpm.conf b/.docker/php/php-fpm.conf deleted file mode 100644 index c51c2212..00000000 --- a/.docker/php/php-fpm.conf +++ /dev/null @@ -1,22 +0,0 @@ -[global] -error_log = /dev/stderr -log_level = error -daemonize = no - -[www] -env[DATABASE_URL] = $DATABASE_URL -env[DEBUG] = $DEBUG -env[LOG_DRIVER] = stderr - -catch_workers_output = yes -user = nginx -group = nginx -listen.owner = nginx -listen.group = nginx -listen = /var/run/php-fpm.sock -pm = dynamic -pm.max_children = 20 -pm.start_servers = 1 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 -pm.max_requests = 2048 diff --git a/.docker/services.d/.s6-svscan/finish b/.docker/services.d/.s6-svscan/finish deleted file mode 100755 index fc3b1e93..00000000 --- a/.docker/services.d/.s6-svscan/finish +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -/bin/true
\ No newline at end of file diff --git a/.docker/services.d/nginx/run b/.docker/services.d/nginx/run deleted file mode 100755 index 40a8b54a..00000000 --- a/.docker/services.d/nginx/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/execlineb -P -nginx -g "daemon off;"
\ No newline at end of file diff --git a/.docker/services.d/php/run b/.docker/services.d/php/run deleted file mode 100755 index e7d2dadd..00000000 --- a/.docker/services.d/php/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/execlineb -P -php-fpm -F
\ No newline at end of file diff --git a/.dockerignore b/.dockerignore index 569d36ca..6376742b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,22 @@ .git .git* +.dockerignore +.vagrant +.idea data/* Makefile .*.yml -*.json
\ No newline at end of file +*.yml +*.js +*.md +*.sh +app.json +bower.json +nitrous.json +package.json +config.php +Vagrantfile +web.config +Makefile +bower_components +node_modules @@ -9,6 +9,7 @@ New features: Improvements: +* Use PHP 7 for the Docker image * Preserve role for existing users when using ReverseProxy authentication * Handle priority for task and project duplication * Expose task reference field to the user interface @@ -1,35 +1,12 @@ -FROM alpine:3.4 -MAINTAINER Frederic Guillot <fred@kanboard.net> +FROM fguillot/alpine-nginx-php7 -RUN apk update && \ - apk add nginx bash ca-certificates s6 curl \ - php5-fpm php5-json php5-zlib php5-xml php5-dom php5-ctype php5-opcache php5-zip \ - php5-pdo php5-pdo_mysql php5-pdo_sqlite php5-pdo_pgsql php5-ldap \ - php5-gd php5-mcrypt php5-openssl php5-phar && \ - rm -rf /var/cache/apk/* +COPY . /var/www/app +COPY docker/kanboard/config.php /var/www/app/config.php +COPY docker/crontab/cronjob.alpine /var/spool/cron/crontabs/nginx +COPY docker/services.d/cron /etc/services.d/cron -RUN curl -sS https://getcomposer.org/installer | php -- --filename=/usr/local/bin/composer - -RUN cd /var/www \ - && curl -LO https://github.com/fguillot/kanboard/archive/master.zip \ - && unzip -qq master.zip \ - && rm -f *.zip \ - && mv kanboard-master kanboard \ - && cd /var/www/kanboard && composer --prefer-dist --no-dev --optimize-autoloader --quiet install \ - && chown -R nginx:nginx /var/www/kanboard \ - && chown -R nginx:nginx /var/lib/nginx - -COPY .docker/services.d /etc/services.d -COPY .docker/php/conf.d/local.ini /etc/php5/conf.d/ -COPY .docker/php/php-fpm.conf /etc/php5/ -COPY .docker/nginx/nginx.conf /etc/nginx/ -COPY .docker/kanboard/config.php /var/www/kanboard/ -COPY .docker/crontab/cronjob.alpine /var/spool/cron/crontabs/nginx - -EXPOSE 80 +RUN cd /var/www/app && composer --prefer-dist --no-dev --optimize-autoloader --quiet install +RUN chown -R nginx:nginx /var/www/app/data /var/www/app/plugins VOLUME /var/www/kanboard/data VOLUME /var/www/kanboard/plugins - -ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"] -CMD [] @@ -26,7 +26,8 @@ archive: @ rm -rf ${BUILD_DIR}/kanboard/*.lock @ rm -rf ${BUILD_DIR}/kanboard/*.json @ rm -rf ${BUILD_DIR}/kanboard/*.js - @ rm -rf ${BUILD_DIR}/kanboard/.docker + @ rm -rf ${BUILD_DIR}/kanboard/.dockerignore + @ rm -rf ${BUILD_DIR}/kanboard/docker @ rm -rf ${BUILD_DIR}/kanboard/nitrous* @ cd ${BUILD_DIR}/kanboard && find ./vendor -name doc -type d -exec rm -rf {} +; @ cd ${BUILD_DIR}/kanboard && find ./vendor -name notes -type d -exec rm -rf {} +; diff --git a/app/constants.php b/app/constants.php index 604f6acd..fc120692 100644 --- a/app/constants.php +++ b/app/constants.php @@ -21,7 +21,7 @@ defined('PLUGIN_INSTALLER') or define('PLUGIN_INSTALLER', true); defined('DEBUG') or define('DEBUG', strtolower(getenv('DEBUG')) === 'true'); // Logging drivers: syslog, stdout, stderr or file -defined('LOG_DRIVER') or define('LOG_DRIVER', getenv('LOG_DRIVER')); +defined('LOG_DRIVER') or define('LOG_DRIVER', ''); // Logging file defined('LOG_FILE') or define('LOG_FILE', DATA_DIR.DIRECTORY_SEPARATOR.'debug.log'); diff --git a/doc/docker.markdown b/doc/docker.markdown index 3f13e954..9af5f57a 100644 --- a/doc/docker.markdown +++ b/doc/docker.markdown @@ -3,17 +3,17 @@ How to run Kanboard with Docker? Kanboard can run easily with [Docker](https://www.docker.com). -The image size is approximately **50MB** and contains: +The image size is approximately **70MB** and contains: - [Alpine Linux](http://alpinelinux.org/) - The [process manager S6](http://skarnet.org/software/s6/) - Nginx -- PHP-FPM +- PHP 7 The Kanboard cronjob is also running everyday at midnight. URL rewriting is enabled in the included config file. -When the container is running, the memory utilization is around **20MB**. +When the container is running, the memory utilization is around **30MB**. Use the stable version ---------------------- diff --git a/doc/env.markdown b/doc/env.markdown index 28f14b18..902066d7 100644 --- a/doc/env.markdown +++ b/doc/env.markdown @@ -7,4 +7,3 @@ Environment variables maybe useful when Kanboard is deployed as container (Docke |---------------|---------------------------------------------------------------------------------------------------------------------------------| | DATABASE_URL | `[database type]://[username]:[password]@[host]:[port]/[database name]`, example: `postgres://foo:foo@myserver:5432/kanboard` | | DEBUG | Enable/Disable debug mode: "true" or "false" | -| LOG_DRIVER | Logging driver: stdout, stderr, file or syslog | diff --git a/docker/crontab/cronjob.alpine b/docker/crontab/cronjob.alpine new file mode 100644 index 00000000..d051ff28 --- /dev/null +++ b/docker/crontab/cronjob.alpine @@ -0,0 +1 @@ +1 0 * * * cd /var/www/app && ./kanboard cronjob diff --git a/docker/php/env.conf b/docker/php/env.conf new file mode 100644 index 00000000..bcf2e37c --- /dev/null +++ b/docker/php/env.conf @@ -0,0 +1,2 @@ +env[DATABASE_URL] = $DATABASE_URL +env[DEBUG] = $DEBUG diff --git a/.docker/services.d/cron/run b/docker/services.d/cron/run index da378099..da378099 100755 --- a/.docker/services.d/cron/run +++ b/docker/services.d/cron/run |