mirror of
https://github.com/grocy/grocy.git
synced 2026-04-08 21:46:16 +02:00
initial work towards dockerized version of grocy
This commit is contained in:
parent
42183ee1d6
commit
4cbfdfb663
6
.dockerignore
Normal file
6
.dockerignore
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
.git
|
||||||
|
.vscode
|
||||||
|
.gitignore
|
||||||
|
build.bat
|
||||||
|
Dockerfile
|
||||||
|
.DS_store
|
||||||
32
Dockerfile-grocy
Normal file
32
Dockerfile-grocy
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
FROM php:7.0-fpm-alpine
|
||||||
|
MAINTAINER Talmai Oliveira <to@talm.ai>
|
||||||
|
|
||||||
|
RUN apk update && \
|
||||||
|
apk upgrade && \
|
||||||
|
mkdir /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 && \
|
||||||
|
sed -i "s|;*listen\s*=\s*/||g" /usr/local/etc/php-fpm.conf && \
|
||||||
|
# sed -i "s|;*log_level\s*=\s*notice|log_level = debug|g" /usr/local/etc/php-fpm.conf && \
|
||||||
|
sed -i "s|;*chdir\s*=\s*/var/www|chdir = /www|g" /usr/local/etc/php-fpm.d/www.conf && \
|
||||||
|
# sed -i "s|;*access.log\s*=\s*log/\$pool.access.log|access.log = \$pool.access.log|g" /usr/local/etc/php-fpm.d/www.conf && \
|
||||||
|
# sed -i "s|;*pm.status_path\s*=\s*/status|pm.status_path = /status|g" /usr/local/etc/php-fpm.d/www.conf && \
|
||||||
|
# sed -i "s|;*memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|i" /usr/local/etc/php.ini && \
|
||||||
|
# sed -i "s|;*upload_max_filesize =.*|upload_max_filesize = ${MAX_UPLOAD}|i" /usr/local/etc/php.ini && \
|
||||||
|
# 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 && \
|
||||||
|
# Cleaning up
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
COPY info.php /www/
|
||||||
|
|
||||||
|
# Set Workdir
|
||||||
|
WORKDIR /www
|
||||||
|
|
||||||
|
# Expose volumes
|
||||||
|
VOLUME ["/www"]
|
||||||
|
|
||||||
|
# Expose ports
|
||||||
|
EXPOSE 9000
|
||||||
32
Dockerfile-grocy-nginx
Normal file
32
Dockerfile-grocy-nginx
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
FROM alpine:latest
|
||||||
|
MAINTAINER Talmai Oliveira <to@talm.ai>
|
||||||
|
|
||||||
|
RUN apk update && \
|
||||||
|
apk upgrade && \
|
||||||
|
apk add --update openssl nginx && \
|
||||||
|
mkdir -p /etc/nginx/certificates && \
|
||||||
|
mkdir -p /var/run/nginx && \
|
||||||
|
mkdir -p /usr/share/nginx/html && \
|
||||||
|
openssl req \
|
||||||
|
-x509 \
|
||||||
|
-newkey rsa:2048 \
|
||||||
|
-keyout /etc/nginx/certificates/key.pem \
|
||||||
|
-out /etc/nginx/certificates/cert.pem \
|
||||||
|
-days 365 \
|
||||||
|
-nodes \
|
||||||
|
-subj /CN=localhost && \
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
COPY docker_nginx/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
COPY docker_nginx/common.conf /etc/nginx/common.conf
|
||||||
|
COPY docker_nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY docker_nginx/conf.d/ssl.conf /etc/nginx/conf.d/ssl.conf
|
||||||
|
|
||||||
|
# Expose volumes
|
||||||
|
VOLUME ["/etc/nginx/conf.d", "/var/log/nginx"]
|
||||||
|
|
||||||
|
# Expose ports
|
||||||
|
EXPOSE 80 443
|
||||||
|
|
||||||
|
# Entry point
|
||||||
|
ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"]
|
||||||
30
docker-compose.yml
Normal file
30
docker-compose.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Usage:
|
||||||
|
# docker-compose build && docker-compose up
|
||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
grocy-nginx:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile-grocy-nginx
|
||||||
|
depends_on:
|
||||||
|
- grocy
|
||||||
|
ports:
|
||||||
|
- '80:80'
|
||||||
|
- '443:443'
|
||||||
|
volumes_from:
|
||||||
|
- grocy
|
||||||
|
container_name: grocy-nginx
|
||||||
|
|
||||||
|
grocy:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile-grocy
|
||||||
|
expose:
|
||||||
|
- 9000
|
||||||
|
environment:
|
||||||
|
PHP_MEMORY_LIMIT: 512M
|
||||||
|
MAX_UPLOAD: 50M
|
||||||
|
PHP_MAX_FILE_UPLOAD: 200
|
||||||
|
PHP_MAX_POST: 100M
|
||||||
|
container_name: grocy
|
||||||
28
docker_nginx/common.conf
Normal file
28
docker_nginx/common.conf
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
index index.php index.html index.htm;
|
||||||
|
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
|
||||||
|
expires 365d;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 404 /404.html;
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_pass grocy:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.ht {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
8
docker_nginx/conf.d/default.conf
Normal file
8
docker_nginx/conf.d/default.conf
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /www; # see: volumes_from
|
||||||
|
|
||||||
|
include /etc/nginx/common.conf;
|
||||||
|
}
|
||||||
20
docker_nginx/conf.d/ssl.conf
Normal file
20
docker_nginx/conf.d/ssl.conf
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /www; # see: volumes_from
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/certificates/cert.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/certificates/key.pem;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
|
# ssl_session_cache shared:SSL:1m;
|
||||||
|
# ssl_session_timeout 5m;
|
||||||
|
|
||||||
|
# ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
# ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
include /etc/nginx/common.conf;
|
||||||
|
|
||||||
|
}
|
||||||
42
docker_nginx/nginx.conf
Normal file
42
docker_nginx/nginx.conf
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
user nobody;
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
pid /var/run/nginx/nginx.pid;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
#tcp_nopush on;
|
||||||
|
|
||||||
|
client_body_timeout 12;
|
||||||
|
client_header_timeout 12;
|
||||||
|
keepalive_timeout 15;
|
||||||
|
send_timeout 10;
|
||||||
|
|
||||||
|
client_body_buffer_size 10K;
|
||||||
|
client_header_buffer_size 1k;
|
||||||
|
client_max_body_size 50M;
|
||||||
|
large_client_header_buffers 2 1k;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_comp_level 2;
|
||||||
|
gzip_min_length 1000;
|
||||||
|
gzip_proxied expired no-cache no-store private auth;
|
||||||
|
gzip_types text/plain application/x-javascript text/xml text/css application/xml;
|
||||||
|
|
||||||
|
access_log on;
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user