2026-03-16 04:20:00 +07:00
|
|
|
FROM php:8.2-fpm-alpine
|
|
|
|
|
|
2026-03-16 07:22:01 +07:00
|
|
|
# Install system dependencies
|
2026-03-16 04:20:00 +07:00
|
|
|
RUN apk add --no-cache \
|
2026-03-22 09:53:38 +07:00
|
|
|
vim \
|
2026-03-22 09:59:02 +07:00
|
|
|
xxd \
|
2026-03-16 04:20:00 +07:00
|
|
|
libzip-dev \
|
|
|
|
|
postgresql-dev \
|
2026-03-16 06:45:23 +07:00
|
|
|
libpng-dev \
|
|
|
|
|
libjpeg-turbo-dev \
|
|
|
|
|
freetype-dev \
|
|
|
|
|
oniguruma-dev \
|
2026-03-16 07:22:01 +07:00
|
|
|
git \
|
|
|
|
|
curl \
|
2026-03-29 13:48:35 +07:00
|
|
|
nodejs \
|
|
|
|
|
npm \
|
2026-03-16 06:45:23 +07:00
|
|
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
2026-03-16 04:20:00 +07:00
|
|
|
&& docker-php-ext-install -j$(nproc) \
|
|
|
|
|
pdo_pgsql \
|
|
|
|
|
pgsql \
|
|
|
|
|
opcache \
|
|
|
|
|
zip \
|
2026-03-16 06:45:23 +07:00
|
|
|
bcmath \
|
|
|
|
|
gd \
|
|
|
|
|
exif \
|
2026-03-16 07:22:01 +07:00
|
|
|
pcntl
|
2026-03-16 04:20:00 +07:00
|
|
|
|
2026-03-16 06:41:29 +07:00
|
|
|
# Install Composer
|
|
|
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
|
|
2026-03-16 04:20:00 +07:00
|
|
|
WORKDIR /var/www/html
|
|
|
|
|
|
2026-03-29 14:53:39 +07:00
|
|
|
# Copy ALL application files first
|
2026-03-29 14:45:23 +07:00
|
|
|
COPY --chown=www-data:www-data . .
|
2026-03-29 14:37:23 +07:00
|
|
|
|
2026-03-29 14:53:39 +07:00
|
|
|
# Remove any nested vendor directories
|
2026-03-29 14:45:23 +07:00
|
|
|
RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true
|
2026-03-29 14:37:23 +07:00
|
|
|
|
2026-03-29 14:53:39 +07:00
|
|
|
# Create all necessary directories with proper structure
|
|
|
|
|
RUN mkdir -p storage/framework/cache \
|
|
|
|
|
&& mkdir -p storage/framework/sessions \
|
|
|
|
|
&& mkdir -p storage/framework/views \
|
|
|
|
|
&& mkdir -p storage/framework/testing \
|
2026-03-29 14:45:23 +07:00
|
|
|
&& mkdir -p storage/logs \
|
|
|
|
|
&& mkdir -p bootstrap/cache \
|
2026-03-29 14:53:39 +07:00
|
|
|
&& mkdir -p storage/framework/cache/data \
|
2026-03-29 14:45:23 +07:00
|
|
|
&& chmod -R 777 storage \
|
|
|
|
|
&& chmod -R 777 bootstrap/cache
|
2026-03-29 14:37:23 +07:00
|
|
|
|
2026-03-29 14:53:39 +07:00
|
|
|
# Create a temporary config to avoid cache path errors
|
|
|
|
|
RUN if [ ! -f config/app.php ]; then \
|
|
|
|
|
echo "<?php return ['providers' => []];" > config/app.php; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Install PHP dependencies with --no-scripts to avoid cache path issues
|
|
|
|
|
RUN composer install --no-interaction --no-progress --optimize-autoloader --no-scripts
|
|
|
|
|
|
2026-03-29 15:12:24 +07:00
|
|
|
# Fix missing laravel/prompts
|
|
|
|
|
RUN if [ ! -f vendor/laravel/prompts/src/helpers.php ]; then \
|
|
|
|
|
composer require laravel/prompts --no-interaction --with-all-dependencies; \
|
|
|
|
|
fi
|
|
|
|
|
|
2026-03-29 14:53:39 +07:00
|
|
|
# Now run the scripts manually with proper environment
|
|
|
|
|
RUN composer run-script post-autoload-dump || true
|
2026-03-29 14:32:03 +07:00
|
|
|
|
|
|
|
|
# Copy package files for NPM
|
2026-03-29 13:48:35 +07:00
|
|
|
COPY package*.json ./
|
|
|
|
|
COPY vite.config.js ./
|
|
|
|
|
|
|
|
|
|
# Install NPM dependencies
|
2026-03-29 14:32:03 +07:00
|
|
|
RUN npm install --legacy-peer-deps --no-audit
|
2026-03-29 13:48:35 +07:00
|
|
|
|
2026-03-29 14:32:03 +07:00
|
|
|
# Build Vite assets
|
2026-03-29 14:53:39 +07:00
|
|
|
RUN npm run build || true
|
2026-03-23 11:32:51 +07:00
|
|
|
|
2026-03-23 11:36:51 +07:00
|
|
|
# Generate application key
|
|
|
|
|
RUN php artisan key:generate --no-interaction --force || true
|
2026-03-16 09:57:31 +07:00
|
|
|
|
2026-03-29 14:53:39 +07:00
|
|
|
# Clear and cache config (but handle missing paths gracefully)
|
|
|
|
|
RUN php artisan config:clear || true \
|
|
|
|
|
&& php artisan cache:clear || true
|
|
|
|
|
|
2026-03-16 10:20:15 +07:00
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
|
|
|
RUN chmod +x /entrypoint.sh
|
2026-03-16 04:20:00 +07:00
|
|
|
|
|
|
|
|
EXPOSE 8000 9000
|
|
|
|
|
|
2026-03-16 10:20:15 +07:00
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|