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 13:48:35 +07:00
|
|
|
# Copy package files first for better caching
|
|
|
|
|
COPY package*.json ./
|
|
|
|
|
COPY vite.config.js ./
|
|
|
|
|
|
|
|
|
|
# Install NPM dependencies
|
|
|
|
|
RUN npm ci --no-audit --no-fund
|
|
|
|
|
|
2026-03-23 11:36:51 +07:00
|
|
|
# Copy application files
|
2026-03-16 04:20:00 +07:00
|
|
|
COPY --chown=www-data:www-data . .
|
|
|
|
|
|
2026-03-23 11:36:51 +07:00
|
|
|
# Remove any nested vendor directories to avoid conflicts
|
|
|
|
|
RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
# Create all necessary directories
|
2026-03-16 09:57:31 +07:00
|
|
|
RUN mkdir -p storage/framework/{cache,sessions,views} \
|
|
|
|
|
&& mkdir -p storage/logs \
|
|
|
|
|
&& mkdir -p bootstrap/cache \
|
2026-03-23 11:27:36 +07:00
|
|
|
&& chmod -R 777 storage \
|
|
|
|
|
&& chmod -R 777 bootstrap/cache
|
2026-03-16 09:57:31 +07:00
|
|
|
|
2026-03-29 13:48:35 +07:00
|
|
|
# Build Vite assets (this generates manifest.json)
|
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
|
|
# Install PHP dependencies
|
2026-03-23 11:36:51 +07:00
|
|
|
RUN composer install --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts \
|
|
|
|
|
&& composer run-script post-autoload-dump \
|
|
|
|
|
&& php artisan package:discover --ansi || 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-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"]
|