diff --git a/.dockerignore b/.dockerignore
index 191381e..55dc64b 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1 +1,3 @@
-.git
\ No newline at end of file
+.git
+docker-compose.yml
+default.conf
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index ef0d2ca..9f5a315 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,8 @@
-FROM php:8.1-fpm
-ENV WORKDIR=/var/www/html
-ENV STORAGE_DIR=${WORKDIR}/storage
+FROM php:8.1.7-fpm
+ARG WORKDIR=/var/www/html
+ENV DOCUMENT_ROOT=${WORKDIR}
ENV LARAVEL_PROCS_NUMBER=1
+ENV NODE_VERSION=16.x
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
@@ -23,9 +24,11 @@ RUN apt-get update && apt-get install -y \
nano \
cron
+RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
+ # Install Node
+RUN apt-get install -y nodejs
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
-
# Install Kafka
RUN git clone https://github.com/arnaud-lb/php-rdkafka.git\
&& cd php-rdkafka \
@@ -60,14 +63,20 @@ RUN docker-php-ext-install pdo_pgsql
# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
-# Copy php.ini file
-COPY php.ini $PHP_INI_DIR/conf.d/
# Install Laravel Envoy
RUN composer global require "laravel/envoy=~1.0"
+
# Set working directory
WORKDIR $WORKDIR
+RUN rm -Rf /var/www/* && \
+mkdir -p /var/www/html
+
+ADD src/index.php $WORKDIR/index.php
+ADD src/php.ini $PHP_INI_DIR/conf.d/
+ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
+
COPY ./entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
RUN ln -s /usr/local/bin/entrypoint.sh /
@@ -79,9 +88,8 @@ ENTRYPOINT ["entrypoint.sh"]
RUN usermod -u 1000 www-data
RUN groupmod -g 1000 www-data
-RUN chmod 755 $WORKDIR
-
-
+RUN chmod -R 755 $WORKDIR
+RUN chown -R www-data:www-data $WORKDIR
EXPOSE 9000
-# entrypoint
CMD [ "entrypoint" ]
+
diff --git a/default.conf b/default.conf
new file mode 100644
index 0000000..fc576a2
--- /dev/null
+++ b/default.conf
@@ -0,0 +1,31 @@
+server {
+ listen 80;
+ index index.php index.html;
+ error_log /var/log/nginx/error.log;
+ access_log /var/log/nginx/access.log;
+ ##Root directory
+ root /var/www/html/public;
+ location ~ \.php$ {
+ try_files $uri =404;
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ ## PHP FPM ( php-fpm:9000 ) or [servicename:9000]
+ fastcgi_pass php-fpm:9000;
+ fastcgi_index index.php;
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_param PATH_INFO $fastcgi_path_info;
+
+ }
+ client_max_body_size 15M;
+ server_tokens off;
+
+ # Hide PHP headers
+ fastcgi_hide_header X-Powered-By;
+ fastcgi_hide_header X-CF-Powered-By;
+ fastcgi_hide_header X-Runtime;
+
+ location / {
+ try_files $uri $uri/ /index.php?$query_string;
+ gzip_static on;
+ }
+}
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..b1f58c1
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,23 @@
+version: '3'
+services:
+ php-fpm:
+ image: jkaninda/laravel-php-fpm:latest
+ container_name: php-fpm
+ restart: unless-stopped
+ volumes:
+ #Project root
+ - ./laravel:/var/www/html
+ networks:
+ - default #if you're using networks between containers
+ #Nginx server
+ nginx-server:
+ image: nginx:alpine
+ container_name: nginx-server
+ restart: unless-stopped
+ ports:
+ - 80:80
+ volumes:
+ - ./laravel:/var/www/html
+ - ./default.conf:/etc/nginx/conf.d/default.conf
+ networks:
+ - default
diff --git a/entrypoint.sh b/entrypoint.sh
index 703b13f..4414a97 100644
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -1,7 +1,6 @@
#!/bin/sh
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
-
echo ""
echo "***********************************************************"
echo " Starting LARAVEL PHP-FPM Docker Container "
@@ -9,31 +8,19 @@ echo "***********************************************************"
set -e
-## Create PHP-FPM worker process
-TASK=/etc/supervisor/conf.d/php-fpm.conf
-touch $TASK
-cat > "$TASK" <