This commit is contained in:
parent
d2396a3d00
commit
0647f28db1
39
Dockerfile
39
Dockerfile
@ -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
15
entrypoint.sh
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user