From 4de85b3e20d565bac1e5ee0d394168dbcada136d Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Sat, 13 Feb 2021 17:23:59 +0100 Subject: [PATCH] add configs for docker build --- Dockerfile | 15 +++++++ config/app.default.php | 10 ++--- config/nginx/nginx.conf | 58 ++++++++++++++++++++++++++++ config/php-fpm/php-ini-overrides.ini | 2 + 4 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 config/nginx/nginx.conf create mode 100644 config/php-fpm/php-ini-overrides.ini diff --git a/Dockerfile b/Dockerfile index e69de29bb..08da69318 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM nginx + +# install php fpm +RUN apt-get update \ + && apt-get -y --no-install-recommends install curl zip php7.3-curl php7.3-zip php7.3-fpm php7.3-mbstring php7.3-intl php7.3-xml php7.3-pdo php7.3-mysql \ + && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* + +# install composer +COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer + +WORKDIR /usr/share/nginx/html + +COPY . . +COPY ./config/nginx/nginx.conf /etc/nginx/nginx.conf +RUN composer install --no-scripts --no-autoloader \ No newline at end of file diff --git a/config/app.default.php b/config/app.default.php index 6e53da67e..89c224c42 100644 --- a/config/app.default.php +++ b/config/app.default.php @@ -263,9 +263,9 @@ return [ * the following line and set the port accordingly */ //'port' => 'non_standard_port_number', - 'username' => 'my_app', - 'password' => 'secret', - 'database' => 'my_app', + 'username' => env('DB_USER', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'database' => env('DB_DATABASE', 'gradido_community'), /* * You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6). */ @@ -294,7 +294,7 @@ return [ */ //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'], - 'url' => env('DATABASE_URL', null), + 'url' => env('MARIADB_URL', null), ], /** @@ -394,7 +394,7 @@ return [ // Gradido specific configuration // Login Server ip and port 'LoginServer' => [ - 'host' => 'http://127.0.0.1', + 'host' => 'login-server', 'port' => 1201 ], diff --git a/config/nginx/nginx.conf b/config/nginx/nginx.conf new file mode 100644 index 000000000..190247953 --- /dev/null +++ b/config/nginx/nginx.conf @@ -0,0 +1,58 @@ +server { + + listen 80 ; + listen [::]:80; + server_name 0.0.0.0; + + #include /etc/nginx/common/protect.conf; + #include /etc/nginx/common/protect_add_header.conf; + #include /etc/nginx/common/ssl.conf; + + + root /usr/share/nginx/html/webroot; + index index.php; + + location ~* \.(png|jpg|ico)\$ { + expires 30d; + } + + location ~* \.(js|css) { + # expires 1d; + expires 1d; + } + + location ~ \.php\$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php7.3-fpm.sock; + #fastcgi_pass 127.0.0.1:9000; + + } + + location ~ /\.ht { + deny all; + } + + location /account { + proxy_http_version 1.1; + proxy_set_header Upgrade \$http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_cache_bypass \$http_upgrade; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$remote_addr; + proxy_set_header Host \$host; + rewrite /account/(.*) /\$1 break; + + #proxy_next_upstream error timeout invalid_header http_502 non_idempotent; + proxy_pass http://login-server:1200; + proxy_redirect off; + + + } + + location / { + try_files \$uri \$uri/ /index.php?\$args; + } + +# access_log /var/log/nginx/access.log main; + +} \ No newline at end of file diff --git a/config/php-fpm/php-ini-overrides.ini b/config/php-fpm/php-ini-overrides.ini new file mode 100644 index 000000000..6b1325362 --- /dev/null +++ b/config/php-fpm/php-ini-overrides.ini @@ -0,0 +1,2 @@ +#upload_max_filesize = 100M +#post_max_size = 108M