]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Add basic docker-compose configuration
authorFabien MEURILLON <fabien@meurillon.org>
Sat, 9 Jan 2016 13:47:32 +0000 (14:47 +0100)
committerFabien MEURILLON <fabien@meurillon.org>
Sun, 10 Jan 2016 13:41:42 +0000 (14:41 +0100)
.gitignore
docker-compose.yml [new file with mode: 0644]
docker/nginx/nginx.conf [new file with mode: 0644]
docker/php/Dockerfile [new file with mode: 0644]

index 9bde27dbcd771209c81325f55632c3696286d70e..0495cb17d700e71fab70793fa84bc713f6de1107 100644 (file)
@@ -36,3 +36,6 @@
 # Data for wallabag
 data/assets/*
 data/db/wallabag*.sqlite
+
+# Docker container logs
+docker/logs/
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..bc46941
--- /dev/null
@@ -0,0 +1,17 @@
+nginx:
+    image: nginx
+    ports:
+        - "8080:80"
+    volumes:
+        - ./docker/nginx/nginx.conf:/nginx.conf
+        - ./docker/logs/nginx:/var/log/nginx
+        - .:/var/www/html
+    links:
+        - php:php
+    command: nginx -c /nginx.conf
+php:
+    build: docker/php
+    ports:
+        - "9000:9000"
+    volumes:
+        - .:/var/www/html
diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf
new file mode 100644 (file)
index 0000000..7e82a0f
--- /dev/null
@@ -0,0 +1,89 @@
+user  nginx;
+worker_processes  1;
+pid        /var/run/nginx.pid;
+
+events {
+    worker_connections  2048;
+    multi_accept on;
+    use epoll;
+}
+
+http {
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    access_log  /var/log/nginx/access.log  main;
+
+    server_tokens off;
+    sendfile on;
+    tcp_nopush on;
+    tcp_nodelay on;
+    keepalive_timeout 15;
+    types_hash_max_size 2048;
+    include /etc/nginx/mime.types;
+    default_type application/octet-stream;
+    access_log off;
+    error_log off;
+    gzip on;
+    gzip_disable "msie6";
+    open_file_cache max=100;
+
+
+    upstream php-upstream {
+        server php:9000;
+    }
+
+    server {
+        #server_name domain.tld www.domain.tld;
+        root /var/www/html/web;
+
+        location / {
+            # try to serve file directly, fallback to app.php
+            try_files $uri /app.php$is_args$args;
+        }
+        # DEV
+        # This rule should only be placed on your development environment
+        # In production, don't include this and don't deploy app_dev.php or config.php
+        location ~ ^/(app_dev|config)\.php(/|$) {
+            fastcgi_pass php-upstream;
+            fastcgi_split_path_info ^(.+\.php)(/.*)$;
+            include fastcgi_params;
+            # When you are using symlinks to link the document root to the
+            # current version of your application, you should pass the real
+            # application path instead of the path to the symlink to PHP
+            # FPM.
+            # Otherwise, PHP's OPcache may not properly detect changes to
+            # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
+            # for more information).
+            fastcgi_param  SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
+            fastcgi_param DOCUMENT_ROOT $realpath_root;
+        }
+        # PROD
+        location ~ ^/app\.php(/|$) {
+            fastcgi_pass php-upstream;
+            fastcgi_split_path_info ^(.+\.php)(/.*)$;
+            include fastcgi_params;
+            # When you are using symlinks to link the document root to the
+            # current version of your application, you should pass the real
+            # application path instead of the path to the symlink to PHP
+            # FPM.
+            # Otherwise, PHP's OPcache may not properly detect changes to
+            # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
+            # for more information).
+            fastcgi_param  SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
+            fastcgi_param DOCUMENT_ROOT $realpath_root;
+            # Prevents URIs that include the front controller. This will 404:
+            # http://domain.tld/app.php/some-path
+            # Remove the internal directive to allow URIs like this
+            internal;
+        }
+
+        error_log /var/log/nginx/project_error.log;
+        access_log /var/log/nginx/project_access.log;
+    }
+
+}
+
+daemon off;
diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile
new file mode 100644 (file)
index 0000000..7c56ae5
--- /dev/null
@@ -0,0 +1,10 @@
+FROM php:fpm
+
+RUN apt-get update && apt-get install -y \
+        libmcrypt-dev libicu-dev libpq-dev libxml2-dev \
+    && docker-php-ext-install \
+        iconv mcrypt mbstring intl pdo pdo_mysql pdo_pgsql
+
+RUN usermod -u 1000 www-data
+
+CMD ["php-fpm"]