mirror of
https://github.com/v2board/v2board.git
synced 2025-09-17 19:53:09 +08:00
feat: adds the possibility of using docker for local deployment using docker-compose.
- nginx - phpmyadmin - php v8.2 - redis - mysql - supervisor
This commit is contained in:
60
docker/Dockerfile.development
Normal file
60
docker/Dockerfile.development
Normal file
@ -0,0 +1,60 @@
|
||||
FROM php:8.2-fpm-alpine
|
||||
LABEL MAINTAINER="Vagner Cardoso <vagnercardosoweb@gmail.com>"
|
||||
|
||||
# Environments
|
||||
ENV TZ=UTC
|
||||
ENV WORKDIR=/var/www
|
||||
|
||||
# Set timezone
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
# Updates and installs system dependencies
|
||||
RUN apk add --update --no-cache \
|
||||
git \
|
||||
bash \
|
||||
curl \
|
||||
zip \
|
||||
unzip \
|
||||
vim \
|
||||
tzdata \
|
||||
libxml2-dev \
|
||||
icu-dev \
|
||||
oniguruma-dev \
|
||||
linux-headers \
|
||||
supervisor \
|
||||
$PHPIZE_DEPS && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
# Configure php dependencies and install
|
||||
RUN docker-php-ext-configure pcntl --enable-pcntl
|
||||
RUN docker-php-ext-install fileinfo bcmath mbstring pdo_mysql intl pcntl sockets
|
||||
|
||||
# Install lib from pecl
|
||||
RUN pecl channel-update pecl.php.net \
|
||||
&& pecl install -o -f xdebug \
|
||||
&& pecl install -o -f redis \
|
||||
&& docker-php-ext-enable xdebug redis \
|
||||
&& rm -rf /tmp/pear
|
||||
|
||||
# Install composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Copy php settings
|
||||
COPY ./php-ini ${PHP_INI_DIR}/conf.d
|
||||
|
||||
# Copy supervisor
|
||||
COPY ./supervisord.conf /etc/supervisord.conf
|
||||
|
||||
# Workdir
|
||||
RUN mkdir -p ${WORKDIR}
|
||||
WORKDIR ${WORKDIR}
|
||||
|
||||
# Expose port
|
||||
EXPOSE 9000
|
||||
|
||||
# Copy entrypoint
|
||||
COPY entrypoint /usr/local/bin/entrypoint
|
||||
RUN chmod +x /usr/local/bin/entrypoint
|
||||
|
||||
# Run supervisor
|
||||
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
|
7
docker/entrypoint
Normal file
7
docker/entrypoint
Normal file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
composer install -vvv -o --working-dir="$WORKDIR"
|
||||
|
||||
php-fpm
|
17
docker/mysql.cnf
Normal file
17
docker/mysql.cnf
Normal file
@ -0,0 +1,17 @@
|
||||
[mysqld]
|
||||
bind-address = 0.0.0.0
|
||||
|
||||
innodb_buffer_pool_size = 1024M
|
||||
|
||||
default_authentication_plugin=mysql_native_password
|
||||
|
||||
# Unicode
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
||||
|
||||
[client]
|
||||
ssl-mode = DISABLED
|
||||
default-character-set = utf8mb4
|
||||
|
||||
[mysql]
|
||||
default-character-set = utf8mb4
|
54
docker/nginx.conf
Normal file
54
docker/nginx.conf
Normal file
@ -0,0 +1,54 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
root /var/www/public;
|
||||
server_name localhost www.localhost;
|
||||
index index.php index.html;
|
||||
|
||||
client_max_body_size 500M;
|
||||
client_body_buffer_size 512k;
|
||||
client_body_in_file_only clean;
|
||||
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
|
||||
charset utf-8;
|
||||
|
||||
access_log /var/www/storage/logs/nginx-access.log;
|
||||
error_log /var/www/storage/logs/nginx-error.log;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
gzip_static on;
|
||||
}
|
||||
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
|
||||
location ~ .*\.(js|css)?$ {
|
||||
expires 1h;
|
||||
error_log off;
|
||||
access_log /dev/null;
|
||||
}
|
||||
|
||||
error_page 404 /index.php;
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
}
|
||||
}
|
6
docker/php-ini/20-xdebug.ini
Normal file
6
docker/php-ini/20-xdebug.ini
Normal file
@ -0,0 +1,6 @@
|
||||
xdebug.start_with_request = no
|
||||
xdebug.mode = debug
|
||||
xdebug.client_host = host.docker.internal
|
||||
xdebug.client_port = 9003
|
||||
xdebug.remote_cookie_expire_time = 36000
|
||||
xdebug.idekey = PHPSTORM
|
17
docker/php-ini/99-php.ini
Normal file
17
docker/php-ini/99-php.ini
Normal file
@ -0,0 +1,17 @@
|
||||
allow_url_fopen = On
|
||||
allow_url_include = Off
|
||||
asp_tags = Off
|
||||
display_errors = On
|
||||
display_startup_errors = On
|
||||
error_reporting = E_ALL
|
||||
enable_dl = Off
|
||||
file_uploads = On
|
||||
max_execution_time = 300
|
||||
max_input_time = 60
|
||||
max_input_vars = 100000
|
||||
memory_limit = 1024M
|
||||
session.gc_maxlifetime = 1440
|
||||
upload_max_filesize = 250M
|
||||
post_max_size = 500M
|
||||
max_file_uploads = 50
|
||||
date.timezone = UTC
|
0
docker/redis-data/.gitkeep
Normal file
0
docker/redis-data/.gitkeep
Normal file
41
docker/supervisord.conf
Normal file
41
docker/supervisord.conf
Normal file
@ -0,0 +1,41 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/var/www/storage/logs/supervisord.log
|
||||
pidfile=/var/www/storage/logs/supervisord.pid
|
||||
|
||||
[program:horizon]
|
||||
command=php /var/www/artisan horizon
|
||||
stopwaitsecs=3600
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
startsecs=3
|
||||
startretries=3
|
||||
stdout_logfile=/var/www/storage/logs/supervisor-horizon.out.log
|
||||
stdout_logfile_maxbytes=2MB
|
||||
stderr_logfile=/var/www/storage/logs/supervisor-horizon.err.log
|
||||
stderr_logfile_maxbytes=2MB
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
user=root
|
||||
priority=999
|
||||
numprocs=1
|
||||
|
||||
[program:laravel-scheduler]
|
||||
command=bash -c "while true; do php /var/www/artisan schedule:run --verbose --no-interaction; sleep 60; done"
|
||||
stopwaitsecs=60
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
startsecs=3
|
||||
startretries=3
|
||||
stdout_logfile=/var/www/storage/logs/supervisor-scheduler.out.log
|
||||
stdout_logfile_maxbytes=2MB
|
||||
stderr_logfile=/var/www/storage/logs/supervisor-scheduler.err.log
|
||||
stderr_logfile_maxbytes=2MB
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
user=root
|
||||
priority=999
|
||||
numprocs=1
|
||||
|
||||
[program:entrypoint]
|
||||
command=/usr/local/bin/entrypoint
|
Reference in New Issue
Block a user