laravel_base
This commit is contained in:
43
docker-compose.yml
Normal file
43
docker-compose.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
php:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: php/Dockerfile
|
||||
restart: always
|
||||
depends_on:
|
||||
- mysql
|
||||
volumes:
|
||||
- eap:/eap
|
||||
environment:
|
||||
DB_HOST: mysql
|
||||
DB_PORT: 3306
|
||||
DB_DATABASE: eap
|
||||
DB_USERNAME: eap
|
||||
DB_PASSWORD: eap123
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
restart: always
|
||||
depends_on:
|
||||
- php
|
||||
volumes:
|
||||
- eap:/eap
|
||||
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
restart: always
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root123
|
||||
MYSQL_DATABASE: eap
|
||||
MYSQL_USER: eap
|
||||
MYSQL_PASSWORD: eap123
|
||||
volumes:
|
||||
- mysql-data:/var/lib/mysql
|
||||
|
||||
volumes:
|
||||
mysql-data:
|
||||
eap:
|
||||
22
nginx/default.conf
Normal file
22
nginx/default.conf
Normal file
@@ -0,0 +1,22 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /eap/public;
|
||||
index index.php index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
}
|
||||
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
73
php/Dockerfile
Normal file
73
php/Dockerfile
Normal file
@@ -0,0 +1,73 @@
|
||||
FROM php:8.3-fpm
|
||||
|
||||
# -----------------------------
|
||||
# Dependências do sistema
|
||||
# -----------------------------
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
unzip \
|
||||
supervisor \
|
||||
redis-server \
|
||||
libpng-dev \
|
||||
libjpeg-dev \
|
||||
libfreetype6-dev \
|
||||
libonig-dev \
|
||||
libxml2-dev \
|
||||
libzip-dev \
|
||||
zip \
|
||||
npm \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# -----------------------------
|
||||
# Extensões PHP
|
||||
# -----------------------------
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-install \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
mbstring \
|
||||
exif \
|
||||
pcntl \
|
||||
bcmath \
|
||||
gd \
|
||||
zip \
|
||||
sockets
|
||||
|
||||
# -----------------------------
|
||||
# Redis PHP extension
|
||||
# -----------------------------
|
||||
RUN pecl install redis \
|
||||
&& docker-php-ext-enable redis
|
||||
|
||||
# -----------------------------
|
||||
# Composer
|
||||
# -----------------------------
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# -----------------------------
|
||||
# Diretórios necessários
|
||||
# -----------------------------
|
||||
RUN mkdir -p /var/log/supervisor \
|
||||
/var/run/supervisor
|
||||
|
||||
# -----------------------------
|
||||
# Diretório da aplicação
|
||||
# -----------------------------
|
||||
WORKDIR /eap
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Supervisor config
|
||||
# -----------------------------
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# -----------------------------
|
||||
# Expor PHP-FPM
|
||||
# -----------------------------
|
||||
EXPOSE 9000
|
||||
|
||||
# -----------------------------
|
||||
# Inicialização
|
||||
# -----------------------------
|
||||
CMD ["/usr/bin/supervisord", "-n"]
|
||||
40
supervisord.conf
Normal file
40
supervisord.conf
Normal file
@@ -0,0 +1,40 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/var/log/supervisor/supervisord.log
|
||||
pidfile=/var/run/supervisord.pid
|
||||
|
||||
; ============================
|
||||
; Redis
|
||||
; ============================
|
||||
[program:redis]
|
||||
command=/usr/bin/redis-server --bind 127.0.0.1 --protected-mode no
|
||||
priority=5
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/supervisor/redis.out.log
|
||||
stderr_logfile=/var/log/supervisor/redis.err.log
|
||||
startsecs=3
|
||||
|
||||
; ============================
|
||||
; PHP-FPM
|
||||
; ============================
|
||||
[program:php-fpm]
|
||||
command=/usr/local/sbin/php-fpm -F
|
||||
priority=10
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/supervisor/php-fpm.out.log
|
||||
stderr_logfile=/var/log/supervisor/php-fpm.err.log
|
||||
|
||||
; ============================
|
||||
; Horizon
|
||||
; ============================
|
||||
[program:horizon]
|
||||
command=php /eap/artisan horizon
|
||||
directory=/eap
|
||||
user=www-data
|
||||
priority=20
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stdout_logfile=/var/log/supervisor/horizon.out.log
|
||||
stderr_logfile=/var/log/supervisor/horizon.err.log
|
||||
Reference in New Issue
Block a user