Install Laravel.
This commit is contained in:
85
docker/dev/php/Dockerfile
Normal file
85
docker/dev/php/Dockerfile
Normal file
@@ -0,0 +1,85 @@
|
||||
FROM php:8.2-fpm
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
apt-utils \
|
||||
man \
|
||||
curl \
|
||||
git \
|
||||
bash \
|
||||
vim \
|
||||
zip unzip \
|
||||
acl \
|
||||
iproute2 \
|
||||
dnsutils \
|
||||
fonts-freefont-ttf \
|
||||
fontconfig \
|
||||
dbus \
|
||||
openssh-client \
|
||||
sendmail \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
icu-devtools \
|
||||
libicu-dev \
|
||||
libmcrypt4 \
|
||||
libmcrypt-dev \
|
||||
libpng-dev \
|
||||
zlib1g-dev \
|
||||
libxml2-dev \
|
||||
libzip-dev \
|
||||
libonig-dev \
|
||||
graphviz \
|
||||
libcurl4-openssl-dev \
|
||||
pkg-config \
|
||||
libldap2-dev \
|
||||
libpq-dev \
|
||||
libbz2-dev \
|
||||
libwebp-dev
|
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
|
||||
RUN apt-get -y install nodejs
|
||||
|
||||
# Clear cache
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install extensions
|
||||
RUN docker-php-ext-configure intl --enable-intl && \
|
||||
docker-php-ext-configure bcmath --enable-bcmath && \
|
||||
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp && \
|
||||
docker-php-ext-install -j$(nproc) gd && \
|
||||
docker-php-ext-install bcmath &&\
|
||||
docker-php-ext-install pdo \
|
||||
pgsql pdo_pgsql \
|
||||
mysqli pdo_mysql \
|
||||
intl iconv mbstring \
|
||||
zip pcntl \
|
||||
exif opcache bz2 \
|
||||
calendar \
|
||||
&& pecl install -o -f redis \
|
||||
&& rm -rf /tmp/pear \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& docker-php-source delete
|
||||
|
||||
# Install composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Add user for laravel application
|
||||
RUN groupadd -g 1000 www
|
||||
RUN useradd -u 1000 -ms /bin/bash -g www www
|
||||
|
||||
# Copy existing application directory contents
|
||||
COPY . /var/www
|
||||
|
||||
# Copy existing application directory permissions
|
||||
COPY --chown=www:www . /var/www
|
||||
|
||||
# Change current user to www
|
||||
USER www
|
||||
|
||||
COPY start.sh /usr/local/bin/start
|
||||
|
||||
CMD ["/usr/local/bin/start"]
|
8
docker/dev/php/config/php.ini
Normal file
8
docker/dev/php/config/php.ini
Normal file
@@ -0,0 +1,8 @@
|
||||
date.timezone = Asia/Almaty
|
||||
|
||||
display_errors = 1
|
||||
error_reporting = E_ALL
|
||||
post_max_size = 1024m
|
||||
upload_max_filesize = 1024m
|
||||
memory_limit = 512M
|
||||
|
4
docker/dev/php/config/xdebug.ini
Normal file
4
docker/dev/php/config/xdebug.ini
Normal file
@@ -0,0 +1,4 @@
|
||||
xdebug.remote_enable = 1
|
||||
xdebug.remote_autostart = 1
|
||||
xdebug.remote_connect_back = 1
|
||||
xdebug.remote_idekey = PHPSTORM
|
22
docker/dev/php/start.sh
Executable file
22
docker/dev/php/start.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
role=${CONTAINER_ROLE:-app}
|
||||
if [ "$role" = "app" ]; then
|
||||
exec php-fpm
|
||||
elif [ "$role" = "queue" ]; then
|
||||
echo "Running the queue..."
|
||||
# php /var/www/html/artisan queue:work --verbose --sleep=5 --tries=10 --max-time=3600
|
||||
php /var/www/html/artisan queue:work --verbose --sleep=5 --tries=10
|
||||
elif [ "$role" = "websockets" ]; then
|
||||
echo "Running the websockets..."
|
||||
php /var/www/html/artisan websockets:serve
|
||||
elif [ "$role" = "scheduler" ]; then
|
||||
while [ true ]
|
||||
do
|
||||
php /var/www/html/artisan schedule:run --verbose --no-interaction &
|
||||
sleep 60
|
||||
done
|
||||
else
|
||||
echo "Could not match the container role \"$role\""
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user