Init commit, env setup, docker + laravel initial install, 1h 25min spent
This commit is contained in:
@@ -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'
|
||||
@@ -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"]
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user