2026-03-31 08:27:42 +07:00
|
|
|
FROM php:8.2-fpm-alpine
|
2026-03-16 04:20:00 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Install system dependencies
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
|
vim \
|
|
|
|
|
xxd \
|
2026-03-31 01:17:24 +07:00
|
|
|
libzip-dev \
|
2026-03-31 08:27:42 +07:00
|
|
|
postgresql-dev \
|
|
|
|
|
libpng-dev \
|
|
|
|
|
libjpeg-turbo-dev \
|
|
|
|
|
freetype-dev \
|
|
|
|
|
oniguruma-dev \
|
|
|
|
|
git \
|
|
|
|
|
curl \
|
2026-03-31 01:17:24 +07:00
|
|
|
nodejs \
|
2026-03-31 08:27:42 +07:00
|
|
|
npm \
|
|
|
|
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
|
|
|
&& docker-php-ext-install -j$(nproc) \
|
|
|
|
|
pdo_pgsql \
|
|
|
|
|
pgsql \
|
|
|
|
|
opcache \
|
|
|
|
|
zip \
|
|
|
|
|
bcmath \
|
|
|
|
|
gd \
|
|
|
|
|
exif \
|
|
|
|
|
pcntl
|
2026-03-16 04:20:00 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Configure git to allow safe directory
|
|
|
|
|
RUN git config --global --add safe.directory /var/www/html
|
2026-03-29 15:33:07 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Install Composer
|
2026-03-16 06:41:29 +07:00
|
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
WORKDIR /var/www/html
|
2026-03-29 14:37:23 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Copy ONLY composer files first
|
|
|
|
|
COPY composer.json ./
|
2026-03-30 17:50:31 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Create storage and bootstrap directories needed for composer scripts
|
|
|
|
|
RUN mkdir -p storage/framework/cache \
|
|
|
|
|
&& mkdir -p storage/framework/sessions \
|
|
|
|
|
&& mkdir -p storage/framework/views \
|
|
|
|
|
&& mkdir -p storage/framework/testing \
|
|
|
|
|
&& mkdir -p storage/logs \
|
|
|
|
|
&& mkdir -p bootstrap/cache \
|
|
|
|
|
&& chmod -R 777 storage \
|
|
|
|
|
&& chmod -R 777 bootstrap/cache
|
2026-03-31 01:32:38 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Configure Composer for stability on unstable networks
|
2026-03-31 01:25:48 +07:00
|
|
|
ENV COMPOSER_ALLOW_SUPERUSER=1 \
|
2026-03-31 08:27:42 +07:00
|
|
|
COMPOSER_MEMORY_LIMIT=-1 \
|
|
|
|
|
COMPOSER_PROCESS_TIMEOUT=2000
|
2026-03-29 19:35:21 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Install PHP dependencies (this layer will be cached)
|
|
|
|
|
RUN composer config -g repo.packagist composer https://packagist.org \
|
|
|
|
|
&& composer install --no-interaction --no-progress --no-scripts --prefer-dist
|
2026-03-29 14:53:39 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Isolate the clean vendor directory
|
|
|
|
|
#RUN mv vendor /vendor_clean
|
|
|
|
|
|
|
|
|
|
# Copy the rest of the application files (will ignore vendor because of .dockerignore)
|
|
|
|
|
COPY --chown=www-data:www-data . .
|
|
|
|
|
|
|
|
|
|
# Restore the clean vendor directory and set proper permissions
|
|
|
|
|
#RUN rm -rf vendor && mv /vendor_clean vendor && chown -R www-data:www-data vendor
|
|
|
|
|
|
|
|
|
|
# Final build verification
|
|
|
|
|
RUN if [ ! -f vendor/laravel/prompts/src/helpers.php ]; then \
|
|
|
|
|
echo "ERROR: laravel/prompts/src/helpers.php missing!" && exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Final check and debug listing
|
|
|
|
|
RUN ls -l vendor/laravel/prompts/src/helpers.php \
|
|
|
|
|
&& du -sh vendor/laravel/prompts
|
|
|
|
|
|
|
|
|
|
# Copy package files for NPM
|
|
|
|
|
COPY package*.json ./
|
|
|
|
|
COPY vite.config.js ./
|
|
|
|
|
|
|
|
|
|
# Install NPM dependencies
|
|
|
|
|
RUN npm install --legacy-peer-deps --no-audit
|
|
|
|
|
|
|
|
|
|
# Build Vite assets
|
|
|
|
|
RUN npm run build
|
2026-03-31 01:17:24 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Copy entrypoint script and ensure it's executable
|
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
|
|
|
RUN chmod +x /entrypoint.sh
|
2026-03-16 04:20:00 +07:00
|
|
|
|
2026-03-31 08:27:42 +07:00
|
|
|
# Let the entrypoint handle artisan commands at runtime
|
|
|
|
|
EXPOSE 8000 9000
|
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|