mirror of
https://github.com/jkaninda/nginx-php-fpm.git
synced 2025-12-07 05:59:44 +01:00
Refactoring
This commit is contained in:
87
src/docker/7.2/Dockerfile
Normal file
87
src/docker/7.2/Dockerfile
Normal file
@@ -0,0 +1,87 @@
|
||||
FROM php:7.2-fpm
|
||||
ARG WORKDIR=/var/www/html
|
||||
ENV DOCUMENT_ROOT=${WORKDIR}
|
||||
ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libmemcached-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
librdkafka-dev \
|
||||
libpq-dev \
|
||||
openssh-server \
|
||||
zip \
|
||||
unzip \
|
||||
supervisor \
|
||||
sqlite3 \
|
||||
nano \
|
||||
cron
|
||||
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
|
||||
# Install Node
|
||||
RUN apt-get install -y nodejs
|
||||
# Install nginx
|
||||
RUN apt-get update && apt-get install -y nginx
|
||||
|
||||
# Clear cache
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install PHP extensions zip, mbstring, exif, bcmath, intl
|
||||
RUN docker-php-ext-configure gd
|
||||
RUN docker-php-ext-install zip mbstring exif pcntl bcmath -j$(nproc) gd intl
|
||||
|
||||
# Install Redis and enable it
|
||||
RUN pecl install redis && docker-php-ext-enable redis
|
||||
|
||||
|
||||
|
||||
# Install the php memcached extension
|
||||
RUN pecl install memcached && docker-php-ext-enable memcached
|
||||
|
||||
# Install the PHP pdo_mysql extention
|
||||
RUN docker-php-ext-install pdo_mysql
|
||||
|
||||
# Install the PHP pdo_pgsql extention
|
||||
RUN docker-php-ext-install pdo_pgsql
|
||||
|
||||
|
||||
# Install Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Set working directory
|
||||
WORKDIR $WORKDIR
|
||||
|
||||
RUN rm -Rf /var/www/* && \
|
||||
mkdir -p /var/www/html
|
||||
|
||||
ADD src/index.php $WORKDIR/index.php
|
||||
ADD src/conf/nginx/default.conf /etc/nginx/sites-available/default
|
||||
ADD src/php.ini $PHP_INI_DIR/conf.d/
|
||||
ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
||||
|
||||
COPY src/entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
RUN ln -s /usr/local/bin/entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 9000 80
|
||||
CMD [ "entrypoint" ]
|
||||
87
src/docker/7.3/Dockerfile
Normal file
87
src/docker/7.3/Dockerfile
Normal file
@@ -0,0 +1,87 @@
|
||||
FROM php:7.3-fpm
|
||||
ARG WORKDIR=/var/www/html
|
||||
ENV DOCUMENT_ROOT=${WORKDIR}
|
||||
ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libmemcached-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
librdkafka-dev \
|
||||
libpq-dev \
|
||||
openssh-server \
|
||||
zip \
|
||||
unzip \
|
||||
supervisor \
|
||||
sqlite3 \
|
||||
nano \
|
||||
cron
|
||||
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
|
||||
# Install Node
|
||||
RUN apt-get install -y nodejs
|
||||
# Install nginx
|
||||
RUN apt-get update && apt-get install -y nginx
|
||||
|
||||
# Clear cache
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install PHP extensions zip, mbstring, exif, bcmath, intl
|
||||
RUN docker-php-ext-configure gd
|
||||
RUN docker-php-ext-install zip mbstring exif pcntl bcmath -j$(nproc) gd intl
|
||||
|
||||
# Install Redis and enable it
|
||||
RUN pecl install redis && docker-php-ext-enable redis
|
||||
|
||||
|
||||
|
||||
# Install the php memcached extension
|
||||
RUN pecl install memcached && docker-php-ext-enable memcached
|
||||
|
||||
# Install the PHP pdo_mysql extention
|
||||
RUN docker-php-ext-install pdo_mysql
|
||||
|
||||
# Install the PHP pdo_pgsql extention
|
||||
RUN docker-php-ext-install pdo_pgsql
|
||||
|
||||
|
||||
# Install Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Set working directory
|
||||
WORKDIR $WORKDIR
|
||||
|
||||
RUN rm -Rf /var/www/* && \
|
||||
mkdir -p /var/www/html
|
||||
|
||||
ADD src/index.php $WORKDIR/index.php
|
||||
ADD src/conf/nginx/default.conf /etc/nginx/sites-available/default
|
||||
ADD src/php.ini $PHP_INI_DIR/conf.d/
|
||||
ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
||||
|
||||
COPY src/entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
RUN ln -s /usr/local/bin/entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 9000 80
|
||||
CMD [ "entrypoint" ]
|
||||
87
src/docker/7.4/Dockerfile
Normal file
87
src/docker/7.4/Dockerfile
Normal file
@@ -0,0 +1,87 @@
|
||||
FROM php:7.4-fpm
|
||||
ARG WORKDIR=/var/www/html
|
||||
ENV DOCUMENT_ROOT=${WORKDIR}
|
||||
ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libmemcached-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
librdkafka-dev \
|
||||
libpq-dev \
|
||||
openssh-server \
|
||||
zip \
|
||||
unzip \
|
||||
supervisor \
|
||||
sqlite3 \
|
||||
nano \
|
||||
cron
|
||||
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
|
||||
# Install Node
|
||||
RUN apt-get install -y nodejs
|
||||
# Install nginx
|
||||
RUN apt-get update && apt-get install -y nginx
|
||||
|
||||
# Clear cache
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install PHP extensions zip, mbstring, exif, bcmath, intl
|
||||
RUN docker-php-ext-configure gd
|
||||
RUN docker-php-ext-install zip mbstring exif pcntl bcmath -j$(nproc) gd intl
|
||||
|
||||
# Install Redis and enable it
|
||||
RUN pecl install redis && docker-php-ext-enable redis
|
||||
|
||||
|
||||
|
||||
# Install the php memcached extension
|
||||
RUN pecl install memcached && docker-php-ext-enable memcached
|
||||
|
||||
# Install the PHP pdo_mysql extention
|
||||
RUN docker-php-ext-install pdo_mysql
|
||||
|
||||
# Install the PHP pdo_pgsql extention
|
||||
RUN docker-php-ext-install pdo_pgsql
|
||||
|
||||
|
||||
# Install Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Set working directory
|
||||
WORKDIR $WORKDIR
|
||||
|
||||
RUN rm -Rf /var/www/* && \
|
||||
mkdir -p /var/www/html
|
||||
|
||||
ADD src/index.php $WORKDIR/index.php
|
||||
ADD src/conf/nginx/default.conf /etc/nginx/sites-available/default
|
||||
ADD src/php.ini $PHP_INI_DIR/conf.d/
|
||||
ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
||||
|
||||
COPY src/entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
RUN ln -s /usr/local/bin/entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 9000 80
|
||||
CMD [ "entrypoint" ]
|
||||
99
src/docker/8.0/Dockerfile
Normal file
99
src/docker/8.0/Dockerfile
Normal file
@@ -0,0 +1,99 @@
|
||||
FROM php:8.0-fpm
|
||||
ARG WORKDIR=/var/www/html
|
||||
ENV DOCUMENT_ROOT=${WORKDIR}
|
||||
ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libmemcached-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
librdkafka-dev \
|
||||
libpq-dev \
|
||||
openssh-server \
|
||||
zip \
|
||||
unzip \
|
||||
supervisor \
|
||||
sqlite3 \
|
||||
nano \
|
||||
cron
|
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
|
||||
# Install Node
|
||||
RUN apt-get install -y nodejs
|
||||
# Install nginx
|
||||
RUN apt-get update && apt-get install -y nginx
|
||||
|
||||
# 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 \
|
||||
&& phpize \
|
||||
&& ./configure \
|
||||
&& make all -j 5 \
|
||||
&& make install
|
||||
|
||||
# Install Rdkafka and enable it
|
||||
RUN docker-php-ext-enable rdkafka \
|
||||
&& cd .. \
|
||||
&& rm -rf /php-rdkafka
|
||||
|
||||
# Install PHP extensions zip, mbstring, exif, bcmath, intl
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
|
||||
RUN docker-php-ext-install zip mbstring exif pcntl bcmath -j$(nproc) gd intl
|
||||
|
||||
# Install Redis and enable it
|
||||
RUN pecl install redis && docker-php-ext-enable redis
|
||||
|
||||
|
||||
|
||||
# Install the php memcached extension
|
||||
RUN pecl install memcached && docker-php-ext-enable memcached
|
||||
|
||||
# Install the PHP pdo_mysql extention
|
||||
RUN docker-php-ext-install pdo_mysql
|
||||
|
||||
# Install the PHP pdo_pgsql extention
|
||||
RUN docker-php-ext-install pdo_pgsql
|
||||
|
||||
|
||||
# Install Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Set working directory
|
||||
WORKDIR $WORKDIR
|
||||
|
||||
RUN rm -Rf /var/www/* && \
|
||||
mkdir -p /var/www/html
|
||||
|
||||
ADD src/index.php $WORKDIR/index.php
|
||||
ADD src/conf/nginx/default.conf /etc/nginx/sites-available/default
|
||||
ADD src/php.ini $PHP_INI_DIR/conf.d/
|
||||
ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
||||
|
||||
COPY src/entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
RUN ln -s /usr/local/bin/entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 9000 80
|
||||
CMD [ "entrypoint" ]
|
||||
100
src/docker/8.1/Dockerfile
Normal file
100
src/docker/8.1/Dockerfile
Normal file
@@ -0,0 +1,100 @@
|
||||
FROM php:8.1.13-fpm
|
||||
ARG WORKDIR=/var/www/html
|
||||
ENV DOCUMENT_ROOT=${WORKDIR}
|
||||
ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libmemcached-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
librdkafka-dev \
|
||||
libpq-dev \
|
||||
openssh-server \
|
||||
zip \
|
||||
unzip \
|
||||
supervisor \
|
||||
sqlite3 \
|
||||
nano \
|
||||
cron
|
||||
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
|
||||
# Install Node
|
||||
RUN apt-get install -y nodejs
|
||||
# Install nginx
|
||||
RUN apt-get update && apt-get install -y nginx
|
||||
|
||||
# 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 \
|
||||
&& phpize \
|
||||
&& ./configure \
|
||||
&& make all -j 5 \
|
||||
&& make install
|
||||
|
||||
# Install Rdkafka and enable it
|
||||
RUN docker-php-ext-enable rdkafka \
|
||||
&& cd .. \
|
||||
&& rm -rf /php-rdkafka
|
||||
|
||||
# Install PHP extensions zip, mbstring, exif, bcmath, intl
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
|
||||
RUN docker-php-ext-install zip mbstring exif pcntl bcmath -j$(nproc) gd intl
|
||||
|
||||
# Install Redis and enable it
|
||||
RUN pecl install redis && docker-php-ext-enable redis
|
||||
|
||||
|
||||
|
||||
# Install the php memcached extension
|
||||
RUN pecl install memcached && docker-php-ext-enable memcached
|
||||
|
||||
# Install the PHP pdo_mysql extention
|
||||
RUN docker-php-ext-install pdo_mysql
|
||||
|
||||
# Install the PHP pdo_pgsql extention
|
||||
RUN docker-php-ext-install pdo_pgsql
|
||||
|
||||
|
||||
# Install Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Set working directory
|
||||
WORKDIR $WORKDIR
|
||||
|
||||
RUN rm -Rf /var/www/* && \
|
||||
mkdir -p /var/www/html
|
||||
|
||||
ADD src/index.php $WORKDIR/index.php
|
||||
ADD src/conf/nginx/default.conf /etc/nginx/sites-available/default
|
||||
ADD src/php.ini $PHP_INI_DIR/conf.d/
|
||||
ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
||||
|
||||
COPY src/entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
RUN ln -s /usr/local/bin/entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 80
|
||||
CMD [ "entrypoint" ]
|
||||
|
||||
100
src/docker/8.2/Dockerfile
Normal file
100
src/docker/8.2/Dockerfile
Normal file
@@ -0,0 +1,100 @@
|
||||
FROM php:8.2.0-fpm
|
||||
ARG WORKDIR=/var/www/html
|
||||
ENV DOCUMENT_ROOT=${WORKDIR}
|
||||
ENV LARAVEL_PROCS_NUMBER=1
|
||||
ENV DOMAIN=_
|
||||
ENV CLIENT_MAX_BODY_SIZE=15M
|
||||
ENV NODE_VERSION=17.x
|
||||
ARG HOST_UID=1000
|
||||
ENV USER=www-data
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libmemcached-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
librdkafka-dev \
|
||||
libpq-dev \
|
||||
openssh-server \
|
||||
zip \
|
||||
unzip \
|
||||
supervisor \
|
||||
sqlite3 \
|
||||
nano \
|
||||
cron
|
||||
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION} | bash -
|
||||
# Install Node
|
||||
RUN apt-get install -y nodejs
|
||||
# Install nginx
|
||||
RUN apt-get update && apt-get install -y nginx
|
||||
|
||||
# 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 \
|
||||
&& phpize \
|
||||
&& ./configure \
|
||||
&& make all -j 5 \
|
||||
&& make install
|
||||
|
||||
# Install Rdkafka and enable it
|
||||
RUN docker-php-ext-enable rdkafka \
|
||||
&& cd .. \
|
||||
&& rm -rf /php-rdkafka
|
||||
|
||||
# Install PHP extensions zip, mbstring, exif, bcmath, intl
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
|
||||
RUN docker-php-ext-install zip mbstring exif pcntl bcmath -j$(nproc) gd intl
|
||||
|
||||
# Install Redis and enable it
|
||||
RUN pecl install redis && docker-php-ext-enable redis
|
||||
|
||||
|
||||
|
||||
# Install the php memcached extension
|
||||
RUN pecl install memcached && docker-php-ext-enable memcached
|
||||
|
||||
# Install the PHP pdo_mysql extention
|
||||
RUN docker-php-ext-install pdo_mysql
|
||||
|
||||
# Install the PHP pdo_pgsql extention
|
||||
RUN docker-php-ext-install pdo_pgsql
|
||||
|
||||
|
||||
# Install Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Set working directory
|
||||
WORKDIR $WORKDIR
|
||||
|
||||
RUN rm -Rf /var/www/* && \
|
||||
mkdir -p /var/www/html
|
||||
|
||||
ADD src/index.php $WORKDIR/index.php
|
||||
ADD src/conf/nginx/default.conf /etc/nginx/sites-available/default
|
||||
ADD src/php.ini $PHP_INI_DIR/conf.d/
|
||||
ADD src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
|
||||
|
||||
COPY src/entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
RUN ln -s /usr/local/bin/entrypoint.sh /
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
|
||||
|
||||
RUN usermod -u ${HOST_UID} www-data
|
||||
RUN groupmod -g ${HOST_UID} www-data
|
||||
|
||||
RUN chmod -R 755 $WORKDIR
|
||||
RUN chown -R www-data:www-data $WORKDIR
|
||||
EXPOSE 80
|
||||
CMD [ "entrypoint" ]
|
||||
|
||||
133
src/entrypoint.sh
Normal file
133
src/entrypoint.sh
Normal file
@@ -0,0 +1,133 @@
|
||||
#!/bin/sh
|
||||
Red='\033[0;31m' # Red
|
||||
Green='\033[0;32m' # Green
|
||||
echo ""
|
||||
echo "***********************************************************"
|
||||
echo " Starting NGINX PHP-FPM Docker Container "
|
||||
echo "***********************************************************"
|
||||
|
||||
set -e
|
||||
|
||||
## Check if the artisan file exists
|
||||
if [ -f /var/www/html/artisan ]; then
|
||||
echo "${Green} artisan file found, creating laravel supervisor config"
|
||||
# Set DocumentRoot to the Laravel project directory
|
||||
export DOCUMENT_ROOT=/var/www/html/public
|
||||
##Create Laravel Scheduler process
|
||||
TASK=/etc/supervisor/conf.d/laravel-worker.conf
|
||||
touch $TASK
|
||||
cat > "$TASK" <<EOF
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
[program:Laravel-scheduler]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=/bin/sh -c "while [ true ]; do (php /var/www/html/artisan schedule:run --verbose --no-interaction &); sleep 60; done"
|
||||
autostart=true
|
||||
autorestart=true
|
||||
numprocs=1
|
||||
user=www-data
|
||||
stdout_logfile=/var/log/laravel_scheduler.out.log
|
||||
redirect_stderr=true
|
||||
|
||||
[program:Laravel-worker]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3
|
||||
autostart=true
|
||||
autorestart=true
|
||||
numprocs=$LARAVEL_PROCS_NUMBER
|
||||
user=www-data
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/var/log/laravel_worker.log
|
||||
EOF
|
||||
echo "${Green} Laravel supervisor config created"
|
||||
else
|
||||
echo "${Red} artisan file not found"
|
||||
fi
|
||||
|
||||
# Enable custom nginx config files if they exist
|
||||
if [ -f /var/www/html/conf/nginx/nginx.conf ]; then
|
||||
cp /var/www/html/conf/nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
echo "Using custom nginx.conf"
|
||||
fi
|
||||
|
||||
if [ -f /var/www/html/conf/nginx/nginx-site.conf ]; then
|
||||
echo "Custom nginx site config found"
|
||||
rm /etc/nginx/sites-available/default
|
||||
cp /var/www/html/conf/nginx/nginx-site.conf /etc/nginx/sites-available/default
|
||||
echo "${Green} Start nginx with custom server config..."
|
||||
else
|
||||
echo "${Red} nginx-site.conf not found"
|
||||
echo "${Green} If you want to use custom configs, create config file in /var/www/html/conf/nginx/nginx-site.conf"
|
||||
echo "${Green} Start nginx with default config..."
|
||||
rm -f /etc/nginx/sites-available/default
|
||||
TASK=/etc/nginx/sites-available/default
|
||||
touch $TASK
|
||||
cat > "$TASK" <<EOF
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name $DOMAIN;
|
||||
# Add index.php to setup Nginx, PHP & PHP-FPM config
|
||||
index index.php index.html index.htm index.nginx-debian.html;
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
root $DOCUMENT_ROOT;
|
||||
# pass PHP scripts on Nginx to FastCGI (PHP-FPM) server
|
||||
location ~ \.php$ {
|
||||
try_files \$uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
# Nginx php-fpm config:
|
||||
fastcgi_pass 127.0.0.1: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 $CLIENT_MAX_BODY_SIZE;
|
||||
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;
|
||||
}
|
||||
location ~ \.css {
|
||||
add_header Content-Type text/css;
|
||||
}
|
||||
location ~ \.js {
|
||||
add_header Content-Type application/x-javascript;
|
||||
}
|
||||
# deny access to Apache .htaccess on Nginx with PHP,
|
||||
# if Apache and Nginx document roots concur
|
||||
location ~ /\.ht {deny all;}
|
||||
location ~ /\.svn/ {deny all;}
|
||||
location ~ /\.git/ {deny all;}
|
||||
location ~ /\.hg/ {deny all;}
|
||||
location ~ /\.bzr/ {deny all;}
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
## Check if the supervisor config file exists
|
||||
if [ -f /var/www/html/conf/worker/supervisor.conf ]; then
|
||||
echo "Custom supervisor config found"
|
||||
cp /var/www/html/conf/worker/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
|
||||
else
|
||||
echo "${Red} Supervisor.conf not found"
|
||||
echo "${Green} If you want to add more supervisor configs, create config file in /var/www/html/conf/worker/supervisor.conf"
|
||||
echo "${Green} Start supervisor with default config..."
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo ""
|
||||
echo "**********************************"
|
||||
echo " Starting Supervisord... "
|
||||
echo "***********************************"
|
||||
supervisord -c /etc/supervisor/supervisord.conf
|
||||
|
||||
Reference in New Issue
Block a user