Init commit, env setup, docker + laravel initial install, 1h 25min spent

This commit is contained in:
Ilya Rogozhin
2026-06-09 14:28:44 +02:00
commit d87eca9ebb
71 changed files with 11371 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
FROM mysql:latest
COPY ./my.cnf /etc/mysql/my.cnf
+45
View File
@@ -0,0 +1,45 @@
[mysqld]
#innodb_flush_method=O_DSYNC
#innodb_flush_method=O_DIRECT_NO_FSYNC
#innodb_use_native_aio=OFF
innodb_force_recovery=0
explain_format=TREE
#log_error_verbosity=3
log_error_suppression_list='MY-013360'
innodb_buffer_pool_size = 1G
innodb_buffer_pool_chunk_size = 250M
innodb_buffer_pool_instances = 4
#innodb_temp_data_file_path = ibtmp1:4G:autoextend
key_buffer_size = 64M
max_heap_table_size = 100M
tmp_table_size = 100M
innodb_log_buffer_size = 32M
#default-time-zone = 'US/Eastern'
local_infile = ON
federated = ON
transaction_isolation = READ-COMMITTED
log_bin_trust_function_creators = 1
enforce_gtid_consistency = ON
gtid_mode = ON
server_id = 2
# secure-file-priv = ""
#slow_query_log = ON
#slow_query_log_file = /var/log/mysql/mysql-slow.log
# long_query_time = 1
# general_log = On
#general_log_file = /var/log/mysql/mysql.log
#log_error = /var/log/mysql/mysql.err.log
[client]
# local_infile = ON
+8
View File
@@ -0,0 +1,8 @@
### LAST LINE
echo "Loading .bash_aliases ..."
### custom list
alias ll="ls --group-directories-first -lAh"
### Artisan
alias ar-clear-all='rm -rf ./storage/framework/{cache, sessions, testing, views} && rm -f ./bootstrap/cache/* && php artisan optimize:clear && php artisan cache:clear && php artisan config:clear && php artisan route:clear && php artisan clear-compiled && composer dump-autoload'
+61
View File
@@ -0,0 +1,61 @@
# ==========================================
# STAGE 1: Build Stage (Optional Dependency Prefetching)
# ==========================================
FROM composer:latest AS builder
# If you don't have production app assets to copy yet, this stage can remain idle.
# ==========================================
# STAGE 2: Final PHP Environment
# ==========================================
FROM php:8.5-fpm-bookworm
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data
# Set work directory matching standard web server setups
WORKDIR /var/www/test-fhr
# Install Linux system dependencies needed for common PHP extensions
RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
unzip \
git \
&& rm -rf /var/lib/apt/lists/*
# Configure and install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install -j$(nproc) gd bcmath pdo_mysql zip
RUN pecl install redis && docker-php-ext-enable redis
# Recommended production PHP configurations
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY ./opcache.ini $PHP_INI_DIR/conf.d/opcache.ini
# ----------------------------------------------------
# COMPOSER & LARAVEL INSTALLER (Safe Direct Method)
# ----------------------------------------------------
# 1. Pull the official global Composer executable binary
COPY --from=builder /usr/bin/composer /usr/local/bin/composer
# 2. Configure user bash profile and aliases
COPY --chown=www-data:www-data ./.bash_aliases /var/www/.bash_aliases
RUN echo "source /var/www/.bash_aliases" >> /var/www/.bashrc
# 3. FIX: Ensure BOTH the home directory and the project directory are owned by www-data
RUN mkdir -p /var/www/.composer /var/www/test-fhr && chown -R www-data:www-data /var/www
# 4. Register the Composer global binaries directory path into the container system
ENV PATH="/var/www/.composer/vendor/bin:${PATH}"
# 5. Switch context to non-root user so paths and permissions map correctly
USER www-data
# 6. Download and unpack the Laravel installer directly into www-data's profile folder
RUN composer global require laravel/installer --no-interaction
# Expose PHP-FPM default communication port
EXPOSE 9000
CMD ["php-fpm"]
+8
View File
@@ -0,0 +1,8 @@
[opcache]
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.revalidate_freq=0
opcache.validate_timestamps=0
opcache.fast_shutdown=1
+16
View File
@@ -0,0 +1,16 @@
memory_limit = 2G
max_execution_time = 18000
display_errors = On
display_startup_errors = On
upload_max_filesize = 32M
post_max_size = 32M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
error_log = /var/log/php_error.log
opcache.enable=1
opcache.validate_timestamps=1
opcache.revalidate_freq=0
+18
View File
@@ -0,0 +1,18 @@
[global]
daemonize = no
[www]
listen = 9000
; Unix user/group of the child processes. This can be used only if the master
; process running user is root. It is set after the child process is created.
; The user and group can be specified either by their name or by their numeric
; IDs.
; Note: If the user is root, the executable needs to be started with
; --allow-to-run-as-root option to work.
; Default Values: The user is set to master process running user by default.
; If the group is not set, the user's group is used.
;user = www-data
;group = www-data
user = root
group = root