Compare commits

..
1 Commits
Author SHA1 Message Date
Zaki-Malla 3c885722f3 Initial commit - Tabeley Backend 2026-02-17 19:33:49 +03:00
111 changed files with 50 additions and 109 deletions
-65
View File
@@ -1,65 +0,0 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
# PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=tabeley_db
DB_USERNAME=postgres
DB_PASSWORD=secret
SESSION_DRIVER=file
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
CACHE_STORE=file
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"
-36
View File
@@ -1,36 +0,0 @@
FROM php:8.3-fpm
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
libicu-dev \
libpng-dev \
libzip-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
unzip \
git \
curl \
zip \
&& rm -rf /var/lib/apt/lists/*
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:2 /usr/bin/composer /usr/bin/composer
WORKDIR /var/www
COPY composer.json composer.lock ./
RUN composer install --no-dev --prefer-dist --no-interaction --no-scripts --optimize-autoloader
COPY . .
RUN chown -R www-data:www-data storage bootstrap/cache \
&& chmod -R ug+rw storage bootstrap/cache \
&& chmod +x docker/entrypoint.sh
ENTRYPOINT ["docker/entrypoint.sh"]
EXPOSE 9000
CMD ["php-fpm"]
+23
View File
@@ -0,0 +1,23 @@
FROM php:8.3-cli
RUN apt-get update && apt-get install -y \
libpq-dev \
libicu-dev \
libpng-dev \
unzip \
git \
curl
RUN docker-php-ext-install pdo_pgsql pgsql intl gd
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www
COPY . .
RUN composer install --no-dev --optimize-autoloader
EXPOSE 8000
CMD php artisan serve --host=0.0.0.0 --port=8000
View File
View File
@@ -11,9 +11,17 @@ services:
APP_ENV: production
APP_DEBUG: "false"
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"
depends_on:
- db
volumes:
- storage_data:/var/www/storage
- storage_data:/var/www/html/storage
nginx:
image: nginx:1.27-alpine
@@ -24,7 +32,7 @@ services:
ports:
- "8000:80"
volumes:
- ./public:/var/www/public:ro
- ./public:/var/www/html/public:ro
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
db:
@@ -3,11 +3,14 @@ set -e
cd /var/www
echo "🚀 Starting Tabeley Production Container..."
# Create .env if not exists
if [ ! -f .env ]; then
cp .env.example .env
fi
# Update .env keys from runtime environment variables when provided.
# Function to safely update env values
set_env() {
key="$1"
value="$2"
@@ -20,30 +23,38 @@ set_env() {
fi
}
# Inject runtime environment variables
set_env DB_CONNECTION "${DB_CONNECTION}"
set_env DB_HOST "${DB_HOST}"
set_env DB_PORT "${DB_PORT}"
set_env DB_DATABASE "${DB_DATABASE}"
set_env DB_USERNAME "${DB_USERNAME}"
set_env DB_PASSWORD "${DB_PASSWORD}"
set_env DB_URL "${DB_URL}"
set_env DATABASE_URL "${DATABASE_URL}"
set_env APP_ENV "${APP_ENV}"
set_env APP_DEBUG "${APP_DEBUG}"
set_env APP_URL "${APP_URL}"
# Laravel setup
php artisan config:clear || true
if ! grep -q "^APP_KEY=base64:" .env; then
if [ -z "$APP_KEY" ]; then
php artisan key:generate --force --no-interaction || true
fi
php artisan storage:link || true
# Run migrations only if enabled
if [ "${RUN_MIGRATIONS}" = "true" ]; then
echo "📦 Running migrations..."
php artisan migrate --force --no-interaction || true
fi
# Cache for production performance
php artisan config:cache || true
php artisan route:cache || true
php artisan view:cache || true
echo "✅ Container ready."
exec "$@"
@@ -1,7 +1,7 @@
server {
listen 80;
server_name _;
root /var/www/public;
root /var/www/html/public;
index index.php index.html;
client_max_body_size 20M;
@@ -14,8 +14,8 @@ server {
include fastcgi_params;
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/public$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/www/public;
fastcgi_param SCRIPT_FILENAME /var/www/html/public$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/www/html/public;
fastcgi_read_timeout 300;
}
View File

Some files were not shown because too many files have changed in this diff Show More