From 5a199fccb4431cfbf7aa6e4e3ea16c4a465b3540 Mon Sep 17 00:00:00 2001 From: glovetleong Date: Thu, 27 Oct 2022 00:48:18 +0800 Subject: [PATCH] docker setup --- docker-setup/Dockerfile | 28 ++++++++++++++++++++++++++++ docker-setup/nginx/default.conf | 27 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 docker-setup/Dockerfile create mode 100644 docker-setup/nginx/default.conf diff --git a/docker-setup/Dockerfile b/docker-setup/Dockerfile new file mode 100644 index 00000000..13ce0249 --- /dev/null +++ b/docker-setup/Dockerfile @@ -0,0 +1,28 @@ +FROM php:7.4-fpm + +WORKDIR /var/www/html + +RUN docker-php-ext-install pdo pdo_mysql + +RUN apt-get update && apt-get install -y \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libzip-dev \ + zip \ + cron \ + supervisor \ + nano \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j$(nproc) gd \ + && docker-php-ext-install zip \ + && docker-php-ext-install bcmath + +COPY --from=composer:1.9.3 /usr/bin/composer /usr/bin/composer + +#NODEJS & NPM +RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - +RUN apt-get -y install nodejs + +RUN chown -R www-data:www-data /var/www +RUN chmod 755 /var/www \ No newline at end of file diff --git a/docker-setup/nginx/default.conf b/docker-setup/nginx/default.conf new file mode 100644 index 00000000..8761015c --- /dev/null +++ b/docker-setup/nginx/default.conf @@ -0,0 +1,27 @@ +server { + listen 80; + index index.php index.html; + server_name localhost; + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + root /var/www/html/public; + + server_name localhost; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass php:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_intercept_errors on; + fastcgi_keep_conn on; + fastcgi_param PHP_VALUE "auto_prepend_file= \n allow_url_include=Off"; + } +} \ No newline at end of file