diff --git a/Dockerfile b/Dockerfile index f97deac79c25e28fdff5124b2a5241e6c1d25417..22cbc638e4c920c422d1fd068beafc28ba78efd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,30 @@ -FROM debian:buster +FROM nginx -RUN apt-get update && apt-get install -y \ - composer \ - php7.2 \ - php-mbstring \ - php7.2-xml\ - php-zip \ - php-gd \ - php-sqlite3 \ - php-mysql \ - php-curl \ - redis-server \ - sqlite3 \ - nodejs \ - libpng-dev \ - unzip \ - npm -RUN npm install gulp -g +RUN apt -y update && apt -y install php-fpm \ + ca-certificates \ + zip \ + php7.3-common \ + php7.3-curl \ + php7.3-mbstring \ + php7.3-sqlite3 \ + php7.3-xml \ + php7.3-zip \ + php7.3-redis \ + php7.3-gd \ + redis-server -COPY . /app -WORKDIR app -RUN mv config/sumas.xml.example config/sumas.xml && mv .env.example .env -RUN composer install --no-plugins --no-scripts -RUN npm install -RUN npm run dev +RUN sed -i 's/listen.owner = www-data/listen.owner = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf && \ + sed -i 's/listen.group = www-data/listen.group = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf && \ + sed -i 's/user = www-data/user = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf && \ + sed -i 's/group = www-data/group = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf && \ + sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.3/fpm/php.ini && \ + mkdir /html -RUN php artisan key:generate +WORKDIR /html +EXPOSE 80 -CMD redis-server --daemonize yes && php artisan serve --host=0.0.0.0 +COPY config/nginx.conf /etc/nginx/nginx.conf +COPY config/nginx-default.conf /etc/nginx/conf.d/default.conf +COPY . /html -EXPOSE 8000 +CMD /etc/init.d/php7.3-fpm start && /etc/init.d/nginx start && /etc/init.d/redis-server start && php artisan worker:spawner diff --git a/config/nginx-default.conf b/config/nginx-default.conf new file mode 100644 index 0000000000000000000000000000000000000000..946abda6eab5ca7a8e36793d2a3b54e6ce8400d6 --- /dev/null +++ b/config/nginx-default.conf @@ -0,0 +1,54 @@ +server { + listen 80; + server_name localhost; + root /html/public; + index index.php index.html index.htm; + + #charset koi8-r; + #access_log /var/log/nginx/host.access.log main; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + try_files $uri /index.php =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} \ No newline at end of file diff --git a/config/nginx.conf b/config/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..37937533858b6ce991610d9ce3c0a1bfe6b24e15 --- /dev/null +++ b/config/nginx.conf @@ -0,0 +1,32 @@ + +user nginx; +worker_processes 100; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/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"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + gzip on; + + include /etc/nginx/conf.d/*.conf; +} \ No newline at end of file