Create docker setup
This commit is contained in:
parent
f338d791a7
commit
5fc691c02a
28
.docker/nginx/default.conf
Normal file
28
.docker/nginx/default.conf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
root /var/www/html/public;
|
||||||
|
|
||||||
|
index index.php;
|
||||||
|
#client_max_body_size 100m;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php {
|
||||||
|
try_files $uri /index.php =404;
|
||||||
|
fastcgi_pass php:9000;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||||
|
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.(?:ht|git|svn) {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
36
.docker/php/Dockerfile
Normal file
36
.docker/php/Dockerfile
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
FROM php:8.4-fpm
|
||||||
|
ARG TIMEZONE
|
||||||
|
|
||||||
|
COPY php.ini /usr/local/etc/php/conf.d/docker-php-config.ini
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
gnupg \
|
||||||
|
g++ \
|
||||||
|
procps \
|
||||||
|
openssl \
|
||||||
|
git \
|
||||||
|
unzip \
|
||||||
|
zlib1g-dev \
|
||||||
|
libzip-dev \
|
||||||
|
libfreetype6-dev \
|
||||||
|
libpng-dev \
|
||||||
|
libjpeg-dev \
|
||||||
|
libicu-dev \
|
||||||
|
libonig-dev \
|
||||||
|
libxslt1-dev \
|
||||||
|
acl \
|
||||||
|
&& echo 'alias sf="php bin/console"' >> ~/.bashrc
|
||||||
|
|
||||||
|
RUN docker-php-ext-configure gd --with-jpeg --with-freetype
|
||||||
|
|
||||||
|
RUN docker-php-ext-install \
|
||||||
|
pdo pdo_mysql zip xsl gd intl opcache exif mbstring
|
||||||
|
|
||||||
|
# Set timezone
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && echo ${TIMEZONE} > /etc/timezone \
|
||||||
|
&& printf '[PHP]\ndate.timezone = "%s"\n', ${TIMEZONE} > /usr/local/etc/php/conf.d/tzone.ini \
|
||||||
|
&& "date"
|
||||||
|
|
||||||
|
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||||
|
|
||||||
|
WORKDIR /var/www/html
|
13
.docker/php/php.ini
Normal file
13
.docker/php/php.ini
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
memory_limit=1024M
|
||||||
|
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.revalidate_freq=10
|
||||||
|
opcache.validate_timestamps=1
|
||||||
|
opcache.max_accelerated_files=10000
|
||||||
|
opcache.memory_consumption=192
|
||||||
|
opcache.max_wasted_percentage=10
|
||||||
|
opcache.interned_strings_buffer=1
|
||||||
|
opcache.fast_shutdown=1
|
||||||
|
|
||||||
|
upload_max_filesize = 20M
|
||||||
|
post_max_size = 20M
|
37
docker-compose.yaml
Normal file
37
docker-compose.yaml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:stable
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
volumes:
|
||||||
|
- .:/var/www/html
|
||||||
|
- ./.docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
depends_on:
|
||||||
|
- php
|
||||||
|
|
||||||
|
php:
|
||||||
|
build:
|
||||||
|
context: ./.docker/php
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
- .:/var/www/html
|
||||||
|
working_dir: /var/www/html
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: mysql://user:password@db:3306/app?serverVersion=11.7.2-MariaDB
|
||||||
|
APP_ENV: prod
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mariadb:11.7.2
|
||||||
|
environment:
|
||||||
|
MARIADB_ROOT_PASSWORD: password
|
||||||
|
MARIADB_DATABASE: app
|
||||||
|
MARIADB_USER: user
|
||||||
|
MARIADB_PASSWORD: password
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/mysql
|
||||||
|
ports:
|
||||||
|
- "3306"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db_data:
|
Loading…
x
Reference in New Issue
Block a user