frontend and backend
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM php:8.1-fpm
|
||||
FROM php:8.1-fpm-buster
|
||||
|
||||
RUN apt update && apt install -y git wget
|
||||
|
||||
# https://github.com/mlocati/docker-php-extension-installer
|
||||
# https://github.com/mlocati/docker-php-extension-installer#special-requirements
|
||||
RUN curl -sSLf -o /usr/local/bin/install-php-extensions \
|
||||
https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions && \
|
||||
chmod +x /usr/local/bin/install-php-extensions
|
||||
@ -13,25 +14,18 @@ RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/main/web/ins
|
||||
chmod +x composer.phar && \
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
|
||||
RUN wget https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar && \
|
||||
chmod +x pickle.phar && \
|
||||
mv pickle.phar /usr/local/bin/pickle
|
||||
|
||||
RUN wget https://get.symfony.com/cli/installer -O - | bash && \
|
||||
mv /root/.symfony/bin/symfony /usr/local/bin/symfony
|
||||
|
||||
RUN install-php-extensions apcu intl opcache redis timezonedb
|
||||
|
||||
#RUN apt-get update && apt-get install -y \
|
||||
# libfreetype6-dev \
|
||||
# libjpeg62-turbo-dev \
|
||||
# libpng-dev \
|
||||
# && docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
# && docker-php-ext-install -j$(nproc) gd
|
||||
|
||||
RUN apt clean autoclean && \
|
||||
apt autoremove -y && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data
|
||||
RUN chown -R www-data:www-data /var/www
|
||||
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||
COPY zz-custom.ini "$PHP_INI_DIR/conf.d/"
|
||||
COPY zz-custom-php.ini "$PHP_INI_DIR/conf.d/"
|
||||
COPY zz-custom-phpfpm.conf /usr/local/etc/php-fpm.d/zz-docker.conf
|
@ -1,5 +1,5 @@
|
||||
```
|
||||
docker build -t php_symfony --progress=plain .
|
||||
docker run --rm --name phptest php_symfony
|
||||
docker run --rm --name phptest -v $(pwd):/var/www/html --user 1000:1000 php_symfony
|
||||
docker exec -it phptest bash
|
||||
```
|
@ -1,8 +1,31 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
php:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ..:/var/www/html
|
||||
xrges-nginx:
|
||||
image: nginx:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8086:80"
|
||||
volumes:
|
||||
- ../frontend/build:/var/www/frontend
|
||||
- ./zz-default-nginx.conf:/etc/nginx/conf.d/default.conf
|
||||
links:
|
||||
- xrges-php
|
||||
|
||||
xrges-php:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ../backend:/var/www/backend
|
||||
|
||||
xrges-redis:
|
||||
image: redis:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ../home/redis:/data
|
||||
- ./redis.conf:/usr/local/etc/redis/redis.conf
|
||||
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: xrges-network
|
||||
|
1
docker/redis.conf
Normal file
1
docker/redis.conf
Normal file
@ -0,0 +1 @@
|
||||
save 60 1
|
9
docker/zz-custom-phpfpm.conf
Normal file
9
docker/zz-custom-phpfpm.conf
Normal file
@ -0,0 +1,9 @@
|
||||
; cat /usr/local/etc/php-fpm.d/zz-docker.conf
|
||||
[global]
|
||||
daemonize = no
|
||||
|
||||
[www]
|
||||
listen = 9000
|
||||
|
||||
; /dev/stdout -> /proc/self/fd/1
|
||||
access.log = /proc/self/fd/1
|
19
docker/zz-default-nginx.conf
Normal file
19
docker/zz-default-nginx.conf
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
limit_req_zone $binary_remote_addr zone=rlimit:10m rate=10r/s;
|
||||
|
||||
server {
|
||||
access_log /proc/self/fd/1;
|
||||
error_log /proc/self/fd/2;
|
||||
|
||||
index index.html index.php;
|
||||
root /var/www/frontend;
|
||||
|
||||
location /api {
|
||||
include fastcgi_params;
|
||||
|
||||
fastcgi_pass xrges-php:9000;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/backend/public/index.php;
|
||||
|
||||
limit_req zone=rlimit burst=5 nodelay;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user