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