From e1dc9f7b1f35210ca5f76054f28684abf9248540 Mon Sep 17 00:00:00 2001 From: talmai Date: Sun, 30 Sep 2018 00:51:22 -0400 Subject: [PATCH] fully working dockerized grocy --- Dockerfile-grocy | 34 ++++++++++++++++++++++++++++---- README.md | 5 +++-- docker_nginx/conf.d/default.conf | 2 +- docker_nginx/conf.d/ssl.conf | 2 +- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Dockerfile-grocy b/Dockerfile-grocy index dc110925..2f30b4e0 100644 --- a/Dockerfile-grocy +++ b/Dockerfile-grocy @@ -1,9 +1,10 @@ -FROM php:7.0-fpm-alpine +FROM php:7.2-fpm-alpine MAINTAINER Talmai Oliveira RUN apk update && \ apk upgrade && \ - mkdir /www && \ + apk add --update yarn git &&\ + mkdir -p /www && \ # Set environments sed -i "s|;*daemonize\s*=\s*yes|daemonize = no|g" /usr/local/etc/php-fpm.conf && \ sed -i "s|;*listen\s*=\s*127.0.0.1:9000|listen = 9000|g" /usr/local/etc/php-fpm.conf && \ @@ -17,13 +18,38 @@ RUN apk update && \ # sed -i "s|;*max_file_uploads =.*|max_file_uploads = ${PHP_MAX_FILE_UPLOAD}|i" /usr/local/etc/php.ini && \ # sed -i "s|;*post_max_size =.*|post_max_size = ${PHP_MAX_POST}|i" /usr/local/etc/php.ini && \ # sed -i "s|;*cgi.fix_pathinfo=.*|cgi.fix_pathinfo= 0|i" /usr/local/etc/php.ini && \ + wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet && \ # Cleaning up rm -rf /var/cache/apk/* -COPY info.php /www/ +COPY public /www/public +COPY info.php /www/public +COPY controllers /www/controllers +COPY data /www/data +COPY helpers /www/helpers +COPY localization/ /www/localization +COPY middleware/ /www/middleware +COPY migrations/ /www/migrations +COPY publication_assets/ /www/publication_assets +COPY services/ /www/services +COPY views/ /www/views +COPY .yarnrc /www/ +COPY *.php /www/ +COPY *.json /www/ +COPY composer.* /root/.composer/ +COPY *yarn* /www/ +COPY *.sh /www/ + +# run php composer.phar with -vvv for extra debug information +RUN cd /var/www/html && \ + php composer.phar --working-dir=/www/ -n install && \ + cp /www/config-dist.php /www/data/config.php && \ + cd /www && \ + yarn install && \ + chown www-data:www-data -R /www/ # Set Workdir -WORKDIR /www +WORKDIR /www/public # Expose volumes VOLUME ["/www"] diff --git a/README.md b/README.md index 758b5e20..4bfed648 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,13 @@ If, however, your webserver does not support URL rewriting, set `DISABLE_URL_REW ## How to run using Docker +The docker images build are based on [Alpine](https://hub.docker.com/_/alpine/), with an extremelly low footprint (less than 10 MB for nginx, and less than 70MB for grocy with php-fm. That number is eventually bumped up to 150MB after all the dependencies are downloaded, however.). Anyhow, to run using docker just do the following: + ``` -> docker-compose build > docker-compose up ``` -And grocy should be accessible via `http(s)://localhost/`. +And grocy should be accessible via `http(s)://localhost/`. The https option will work. However, since the certificate is self-signed, most browsers will complain. ## How to update Just overwrite everything with the latest release while keeping the `data` directory, check `config-dist.php` for new configuration options and add them to your `data/config.php` (the default from values `config-dist.php` will be used for not in `data/config.php` defined settings). Just to be sure, please empty `data/viewcache`. diff --git a/docker_nginx/conf.d/default.conf b/docker_nginx/conf.d/default.conf index 6520a81e..40b8b2b2 100644 --- a/docker_nginx/conf.d/default.conf +++ b/docker_nginx/conf.d/default.conf @@ -2,7 +2,7 @@ server { listen 80 default_server; server_name _; - root /www; # see: volumes_from + root /www/public; # see: volumes_from include /etc/nginx/common.conf; } \ No newline at end of file diff --git a/docker_nginx/conf.d/ssl.conf b/docker_nginx/conf.d/ssl.conf index 47cced61..65385444 100644 --- a/docker_nginx/conf.d/ssl.conf +++ b/docker_nginx/conf.d/ssl.conf @@ -2,7 +2,7 @@ server { listen 443 ssl; server_name _; - root /www; # see: volumes_from + root /www/public; # see: volumes_from ssl_certificate /etc/nginx/certificates/cert.pem; ssl_certificate_key /etc/nginx/certificates/key.pem;