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-29 15:33:07 +07:00
|
|
|
# Configure git to allow safe directory
|
|
|
|
|
RUN git config --global --add safe.directory /var/www/html
|
|
|
|
|
|
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 15:33:07 +07:00
|
|
|
# Remove composer.lock to ensure fresh install
|
|
|
|
|
RUN rm -f composer.lock
|
|
|
|
|
|
2026-03-29 15:42:51 +07:00
|
|
|
# Create ALL storage directories BEFORE composer install
|
|
|
|
|
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 15:42:51 +07:00
|
|
|
# Create a temporary config file to avoid cache path issues during composer
|
|
|
|
|
RUN if [ ! -f config/app.php ]; then \
|
|
|
|
|
echo "<?php return ['providers' => []];" > config/app.php; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Set environment variable for cache path
|
|
|
|
|
ENV VIEW_COMPILED_PATH=/var/www/html/storage/framework/views
|
|
|
|
|
|
|
|
|
|
# Install PHP dependencies
|
2026-03-29 15:33:07 +07:00
|
|
|
RUN composer install --no-interaction --no-progress --optimize-autoloader
|
2026-03-29 14:53:39 +07:00
|
|
|
|
2026-03-29 15:33:07 +07:00
|
|
|
# Verify critical files exist
|
|
|
|
|
RUN if [ ! -f vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php ]; then \
|
|
|
|
|
echo "ERROR: server.php missing!" && exit 1; \
|
2026-03-29 15:12:24 +07:00
|
|
|
fi
|
|
|
|
|
|
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 15:33:07 +07:00
|
|
|
# Cache configurations
|
|
|
|
|
RUN php artisan config:cache || true
|
2026-03-29 14:53:39 +07:00
|
|
|
|
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"]
|