oks
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Triono Putra 2025-05-28 16:15:24 +07:00
parent d2396a3d00
commit 0647f28db1
2 changed files with 28 additions and 26 deletions

View File

@ -1,40 +1,27 @@
FROM php:8.3-fpm
# Install system dependencies & PHP extensions
# Install dependencies & extensions
RUN apt-get update && apt-get install -y \
libzip-dev \
unzip \
git \
libpq-dev \
libicu-dev \
zip \
curl \
&& docker-php-ext-install \
intl \
zip \
pdo_pgsql \
bcmath
libzip-dev unzip git libpq-dev libicu-dev zip curl \
&& docker-php-ext-install intl zip pdo_pgsql bcmath
# Install Composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www
# Copy source
# Copy project files including entrypoint.sh
COPY . .
COPY .env.example .env
# Install dependencies
RUN composer install --no-interaction --prefer-dist --optimize-autoloader
# Beri permission executable ke entrypoint.sh
RUN chmod +x /var/www/entrypoint.sh
# Generate app key
RUN php artisan key:generate
# Set permissions
RUN chown -R www-data:www-data /var/www \
&& chmod -R 775 storage bootstrap/cache \
&& chown -R www-data:www-data storage bootstrap/cache
# Set permissions folder storage dan cache
RUN mkdir -p storage/framework/{cache,sessions,views} bootstrap/cache && \
chown -R www-data:www-data storage bootstrap/cache && \
chmod -R 775 storage bootstrap/cache
EXPOSE 9000
CMD ["php-fpm"]
# Set entrypoint
ENTRYPOINT ["/var/www/entrypoint.sh"]

15
entrypoint.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# Install dependencies via composer (non-interactive)
composer install --no-interaction --prefer-dist --optimize-autoloader
# Cache config, routes, views
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Jalankan migration otomatis dengan force (untuk production)
php artisan migrate --force
# Jalankan php-fpm (foreground)
exec php-fpm -F