Use PHP7 for Docker image

This commit is contained in:
Frederic Guillot
2016-07-02 22:35:54 -04:00
parent 9bc82296a9
commit 4b5c3b0527
19 changed files with 34 additions and 158 deletions

View File

@@ -1 +0,0 @@
1 0 * * * cd /var/www/kanboard && ./kanboard cronjob >/dev/null 2>&1

View File

@@ -1 +0,0 @@
@daily www-data cd /var/www/html/kanboard && ./kanboard cronjob >/dev/null 2>&1

View File

@@ -1,3 +0,0 @@
<?php
define('ENABLE_URL_REWRITE', true);

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -1,2 +0,0 @@
#!/bin/sh
/bin/true

View File

@@ -1,2 +0,0 @@
#!/bin/execlineb -P
nginx -g "daemon off;"

View File

@@ -1,2 +0,0 @@
#!/bin/execlineb -P
php-fpm -F

View File

@@ -1,6 +1,22 @@
.git .git
.git* .git*
.dockerignore
.vagrant
.idea
data/* data/*
Makefile Makefile
.*.yml .*.yml
*.json *.yml
*.js
*.md
*.sh
app.json
bower.json
nitrous.json
package.json
config.php
Vagrantfile
web.config
Makefile
bower_components
node_modules

View File

@@ -9,6 +9,7 @@ New features:
Improvements: Improvements:
* Use PHP 7 for the Docker image
* Preserve role for existing users when using ReverseProxy authentication * Preserve role for existing users when using ReverseProxy authentication
* Handle priority for task and project duplication * Handle priority for task and project duplication
* Expose task reference field to the user interface * Expose task reference field to the user interface

View File

@@ -1,35 +1,12 @@
FROM alpine:3.4 FROM fguillot/alpine-nginx-php7
MAINTAINER Frederic Guillot <fred@kanboard.net>
RUN apk update && \ COPY . /var/www/app
apk add nginx bash ca-certificates s6 curl \ COPY docker/kanboard/config.php /var/www/app/config.php
php5-fpm php5-json php5-zlib php5-xml php5-dom php5-ctype php5-opcache php5-zip \ COPY docker/crontab/cronjob.alpine /var/spool/cron/crontabs/nginx
php5-pdo php5-pdo_mysql php5-pdo_sqlite php5-pdo_pgsql php5-ldap \ COPY docker/services.d/cron /etc/services.d/cron
php5-gd php5-mcrypt php5-openssl php5-phar && \
rm -rf /var/cache/apk/*
RUN curl -sS https://getcomposer.org/installer | php -- --filename=/usr/local/bin/composer 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
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
VOLUME /var/www/kanboard/data VOLUME /var/www/kanboard/data
VOLUME /var/www/kanboard/plugins VOLUME /var/www/kanboard/plugins
ENTRYPOINT ["/bin/s6-svscan", "/etc/services.d"]
CMD []

View File

@@ -26,7 +26,8 @@ archive:
@ rm -rf ${BUILD_DIR}/kanboard/*.lock @ rm -rf ${BUILD_DIR}/kanboard/*.lock
@ rm -rf ${BUILD_DIR}/kanboard/*.json @ rm -rf ${BUILD_DIR}/kanboard/*.json
@ rm -rf ${BUILD_DIR}/kanboard/*.js @ 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* @ 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 doc -type d -exec rm -rf {} +;
@ cd ${BUILD_DIR}/kanboard && find ./vendor -name notes -type d -exec rm -rf {} +; @ cd ${BUILD_DIR}/kanboard && find ./vendor -name notes -type d -exec rm -rf {} +;

View File

@@ -21,7 +21,7 @@ defined('PLUGIN_INSTALLER') or define('PLUGIN_INSTALLER', true);
defined('DEBUG') or define('DEBUG', strtolower(getenv('DEBUG')) === 'true'); defined('DEBUG') or define('DEBUG', strtolower(getenv('DEBUG')) === 'true');
// Logging drivers: syslog, stdout, stderr or file // 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 // Logging file
defined('LOG_FILE') or define('LOG_FILE', DATA_DIR.DIRECTORY_SEPARATOR.'debug.log'); defined('LOG_FILE') or define('LOG_FILE', DATA_DIR.DIRECTORY_SEPARATOR.'debug.log');

View File

@@ -3,17 +3,17 @@ How to run Kanboard with Docker?
Kanboard can run easily with [Docker](https://www.docker.com). 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/) - [Alpine Linux](http://alpinelinux.org/)
- The [process manager S6](http://skarnet.org/software/s6/) - The [process manager S6](http://skarnet.org/software/s6/)
- Nginx - Nginx
- PHP-FPM - PHP 7
The Kanboard cronjob is also running everyday at midnight. The Kanboard cronjob is also running everyday at midnight.
URL rewriting is enabled in the included config file. 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 Use the stable version
---------------------- ----------------------

View File

@@ -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` | | 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" | | DEBUG | Enable/Disable debug mode: "true" or "false" |
| LOG_DRIVER | Logging driver: stdout, stderr, file or syslog |

View File

@@ -0,0 +1 @@
1 0 * * * cd /var/www/app && ./kanboard cronjob

2
docker/php/env.conf Normal file
View File

@@ -0,0 +1,2 @@
env[DATABASE_URL] = $DATABASE_URL
env[DEBUG] = $DEBUG