mirror of
https://github.com/tiennm99/composes.git
synced 2026-10-11 03:13:16 +00:00
feat: update
This commit is contained in:
1 parent
bf621b5315
commit
d1b1654cff
4 files changed
+100
-56
No files matched your search
+16
-6
@@ -11,15 +11,25 @@ RUN apt-get update && apt-get install -y \
|
||||
libicu-dev \
|
||||
zip \
|
||||
unzip \
|
||||
default-mysql-client
|
||||
|
||||
# Clear cache
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
default-mysql-client \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install PHP extensions
|
||||
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip xml intl
|
||||
RUN docker-php-ext-install \
|
||||
pdo_mysql \
|
||||
mbstring \
|
||||
exif \
|
||||
pcntl \
|
||||
bcmath \
|
||||
gd \
|
||||
zip \
|
||||
xml \
|
||||
intl \
|
||||
ctype \
|
||||
tokenizer
|
||||
|
||||
# Get latest Composer
|
||||
# Install Composer
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Set working directory
|
||||
|
||||
@@ -13,6 +13,8 @@ services:
|
||||
- APP_KEY=
|
||||
- APP_DEBUG=false
|
||||
- APP_URL=http://localhost
|
||||
- IGNITER_LOCATION_MODE=multiple
|
||||
- IGNITER_CARTE_KEY=
|
||||
|
||||
# Database configuration
|
||||
- DB_CONNECTION=mysql
|
||||
@@ -21,14 +23,19 @@ services:
|
||||
- DB_DATABASE=tastyigniter
|
||||
- DB_USERNAME=tastyigniter
|
||||
- DB_PASSWORD=secret_password
|
||||
- DB_PREFIX=ti_
|
||||
|
||||
# Admin account
|
||||
- ADMIN_USER=admin
|
||||
- ADMIN_EMAIL=admin@example.com
|
||||
- ADMIN_PASSWORD=admin123
|
||||
|
||||
# Scheduler and Queue
|
||||
# Cache and Session
|
||||
- BROADCAST_DRIVER=log
|
||||
- CACHE_DRIVER=file
|
||||
- QUEUE_CONNECTION=database
|
||||
- SESSION_DRIVER=file
|
||||
- SESSION_LIFETIME=120
|
||||
|
||||
# Mail Configuration
|
||||
- MAIL_MAILER=log
|
||||
- MAIL_FROM_ADDRESS=noreply@tastyigniter.tld
|
||||
- MAIL_FROM_NAME=TastyIgniter
|
||||
volumes:
|
||||
- tastyigniter:/var/www/html
|
||||
- tastyigniter-storage:/var/www/html/storage
|
||||
@@ -41,8 +48,8 @@ services:
|
||||
image: nginx:alpine
|
||||
container_name: tastyigniter-nginx
|
||||
restart: unless-stopped
|
||||
# ports:
|
||||
# - "80:80"
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- tastyigniter:/var/www/html
|
||||
- ./docker/nginx:/etc/nginx/conf.d
|
||||
|
||||
@@ -4,9 +4,8 @@ set -e
|
||||
# Check if TastyIgniter is already installed
|
||||
if [ ! -f /var/www/html/composer.json ] || [ ! -d /var/www/html/vendor ]; then
|
||||
echo "Installing TastyIgniter..."
|
||||
# Create new TastyIgniter project with fallback for handling extension requirements
|
||||
composer create-project tastyigniter/tastyigniter:^v4.0 /tmp/tastyigniter --prefer-dist --no-interaction --no-progress || \
|
||||
composer create-project tastyigniter/tastyigniter:^v4.0 /tmp/tastyigniter --prefer-dist --no-interaction --no-progress --ignore-platform-req=ext-intl
|
||||
# Create new TastyIgniter project
|
||||
composer create-project tastyigniter/tastyigniter:^v4.0 /tmp/tastyigniter --prefer-dist --no-interaction --no-progress
|
||||
|
||||
# Move files to web root
|
||||
cp -a /tmp/tastyigniter/. /var/www/html/
|
||||
@@ -15,6 +14,11 @@ if [ ! -f /var/www/html/composer.json ] || [ ! -d /var/www/html/vendor ]; then
|
||||
echo "TastyIgniter files installed"
|
||||
fi
|
||||
|
||||
# Set proper permissions
|
||||
chown -R www-data:www-data /var/www/html
|
||||
chmod -R 755 /var/www/html
|
||||
chmod -R 775 /var/www/html/storage
|
||||
|
||||
# Generate app key if not set
|
||||
if [ -z "$APP_KEY" ]; then
|
||||
php artisan key:generate
|
||||
@@ -27,7 +31,7 @@ while ! mysql -h "$DB_HOST" -u "$DB_USERNAME" -p"$DB_PASSWORD" -e "SELECT 1" >/d
|
||||
done
|
||||
echo "Database connection established"
|
||||
|
||||
# Run TastyIgniter installer in non-interactive mode
|
||||
# Run TastyIgniter installer in non-interactive mode if not installed
|
||||
if [ ! -f .env ] || ! grep -q "IGNITER_INSTALLED=true" .env; then
|
||||
echo "Running TastyIgniter installer..."
|
||||
php artisan igniter:install --no-interaction
|
||||
@@ -40,38 +44,7 @@ else
|
||||
echo "TastyIgniter already installed"
|
||||
fi
|
||||
|
||||
# Check for TastyIgniter's .nginx.conf file and copy it if needed
|
||||
if [ -f /var/www/html/.nginx.conf ]; then
|
||||
echo "TastyIgniter .nginx.conf found"
|
||||
else
|
||||
echo "TastyIgniter .nginx.conf not found, creating a default one"
|
||||
cat > /var/www/html/.nginx.conf <<EOF
|
||||
# Default TastyIgniter nginx config
|
||||
location / {
|
||||
root /var/www/html/public;
|
||||
try_files \$uri \$uri/ /index.php?\$query_string;
|
||||
index index.php;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
root /var/www/html/public;
|
||||
try_files \$uri \$uri/ /index.php?\$query_string;
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Set permissions again to ensure proper access
|
||||
chown -R www-data:www-data /var/www/html
|
||||
chmod -R 755 /var/www/html/storage
|
||||
# Run database migrations if needed
|
||||
php artisan migrate --force
|
||||
|
||||
exec "$@"
|
||||
@@ -2,17 +2,71 @@ server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
root /var/www/html;
|
||||
root /var/www/html/public;
|
||||
index index.php;
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header X-Content-Type-Options "nosniff";
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_comp_level 5;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types text/plain text/css application/x-javascript application/json application/javascript image/x-icon image/png image/gif image/jpeg image/svg+xml;
|
||||
gzip_types application/javascript application/x-javascript application/json
|
||||
text/css text/plain text/xml application/xml
|
||||
image/svg+xml image/x-icon
|
||||
application/vnd.ms-fontobject application/x-font-ttf font/opentype;
|
||||
|
||||
charset utf-8;
|
||||
client_max_body_size 100M;
|
||||
fastcgi_read_timeout 1800;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
}
|
||||
|
||||
# Deny access to . files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
# Allow fpm ping and status
|
||||
location ~ ^/(fpm-status|fpm-ping)$ {
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
fastcgi_pass app:9000;
|
||||
}
|
||||
|
||||
# Deny access to sensitive files
|
||||
location ~* \.(env|log|git|key|md|yml|yaml|conf)$ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Assets caching
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||
expires max;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
|
||||
access_log off;
|
||||
|
||||
# Include TastyIgniter's nginx configuration
|
||||
include /var/www/html/.nginx.conf;
|
||||
error_log /var/log/nginx/error.log error;
|
||||
}
|
||||
Reference in new issue
Block a user