FROM php:7.4-fpm-alpine # Set working directory WORKDIR /var/www/html COPY composer.json composer.lock /var/www/html/ RUN apk add oniguruma-dev --no-cache postgresql-dev libxml2-dev git vim nano curl zip unzip RUN docker-php-ext-install \ bcmath \ ctype \ fileinfo \ json \ mbstring \ pdo_mysql \ pdo_pgsql \ tokenizer \ xml # Install composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Copy existing application directory contents COPY . /var/www/html # Install dependency RUN composer install --no-interaction # Copy directory project permission ke container COPY --chown=www-data:www-data . /var/www/html RUN chown -R www-data:www-data /var/www/html RUN chown -R www-data:www-data /var/www/html/storage # Optimizing Configuration loading RUN php artisan optimize:clear # Ganti user ke www-data USER www-data # Expose port 9000 and start php-fpm server EXPOSE 9000 # CMD ["php-fpm"]