أُنشئ من Tokal/Test
Fix production Docker runtime for server deployment
هذا الالتزام موجود في:
31
Dockerfile
31
Dockerfile
@@ -1,29 +1,36 @@
|
|||||||
FROM php:8.3-apache
|
FROM php:8.3-fpm
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
libicu-dev \
|
libicu-dev \
|
||||||
libpng-dev \
|
libpng-dev \
|
||||||
libzip-dev \
|
libzip-dev \
|
||||||
|
libjpeg62-turbo-dev \
|
||||||
|
libfreetype6-dev \
|
||||||
unzip \
|
unzip \
|
||||||
git \
|
git \
|
||||||
curl \
|
curl \
|
||||||
zip
|
zip \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN docker-php-ext-install pdo_pgsql pgsql intl gd zip
|
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||||
|
&& docker-php-ext-install -j"$(nproc)" pdo_pgsql pgsql intl gd zip
|
||||||
|
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www
|
||||||
|
|
||||||
|
COPY composer.json composer.lock ./
|
||||||
|
RUN composer install --no-dev --prefer-dist --no-interaction --no-scripts --optimize-autoloader
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN composer install --no-dev --optimize-autoloader
|
RUN chown -R www-data:www-data storage bootstrap/cache \
|
||||||
|
&& chmod -R ug+rw storage bootstrap/cache \
|
||||||
|
&& chmod +x docker/entrypoint.sh
|
||||||
|
|
||||||
RUN chown -R www-data:www-data storage bootstrap/cache
|
ENTRYPOINT ["docker/entrypoint.sh"]
|
||||||
|
|
||||||
RUN a2enmod rewrite
|
EXPOSE 9000
|
||||||
|
|
||||||
EXPOSE 80
|
CMD ["php-fpm"]
|
||||||
|
|
||||||
CMD ["apache2-foreground"]
|
|
||||||
|
|||||||
@@ -11,17 +11,9 @@ services:
|
|||||||
APP_ENV: production
|
APP_ENV: production
|
||||||
APP_DEBUG: "false"
|
APP_DEBUG: "false"
|
||||||
APP_URL: ${APP_URL:-http://127.0.0.1:8000}
|
APP_URL: ${APP_URL:-http://127.0.0.1:8000}
|
||||||
DB_CONNECTION: pgsql
|
|
||||||
DB_HOST: db
|
|
||||||
DB_PORT: 5432
|
|
||||||
DB_DATABASE: ${DB_DATABASE:-tabeley_db}
|
|
||||||
DB_USERNAME: ${DB_USERNAME:-postgres}
|
|
||||||
DB_PASSWORD: ${DB_PASSWORD:-secret}
|
|
||||||
RUN_MIGRATIONS: "true"
|
RUN_MIGRATIONS: "true"
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
volumes:
|
volumes:
|
||||||
- storage_data:/var/www/html/storage
|
- storage_data:/var/www/storage
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:1.27-alpine
|
image: nginx:1.27-alpine
|
||||||
@@ -32,7 +24,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8000:80"
|
- "8000:80"
|
||||||
volumes:
|
volumes:
|
||||||
- ./public:/var/www/html/public:ro
|
- ./public:/var/www/public:ro
|
||||||
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
|
||||||
db:
|
db:
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ set_env APP_DEBUG "${APP_DEBUG}"
|
|||||||
set_env APP_URL "${APP_URL}"
|
set_env APP_URL "${APP_URL}"
|
||||||
|
|
||||||
php artisan config:clear || true
|
php artisan config:clear || true
|
||||||
php artisan key:generate --force --no-interaction || true
|
if ! grep -q "^APP_KEY=base64:" .env; then
|
||||||
|
php artisan key:generate --force --no-interaction || true
|
||||||
|
fi
|
||||||
php artisan storage:link || true
|
php artisan storage:link || true
|
||||||
|
|
||||||
if [ "${RUN_MIGRATIONS}" = "true" ]; then
|
if [ "${RUN_MIGRATIONS}" = "true" ]; then
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name _;
|
server_name _;
|
||||||
root /var/www/html/public;
|
root /var/www/public;
|
||||||
index index.php index.html;
|
index index.php index.html;
|
||||||
|
|
||||||
client_max_body_size 20M;
|
client_max_body_size 20M;
|
||||||
@@ -14,8 +14,8 @@ server {
|
|||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_pass app:9000;
|
fastcgi_pass app:9000;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
fastcgi_param SCRIPT_FILENAME /var/www/html/public$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME /var/www/public$fastcgi_script_name;
|
||||||
fastcgi_param DOCUMENT_ROOT /var/www/html/public;
|
fastcgi_param DOCUMENT_ROOT /var/www/public;
|
||||||
fastcgi_read_timeout 300;
|
fastcgi_read_timeout 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم