Files
kulakpos_web/Dockerfile2

52 lines
1.7 KiB
Plaintext
Raw Normal View History

2026-03-31 01:17:24 +07:00
FROM php:8.4-fpm
# 1. Setup NodeSource untuk instalasi Node.js v20 (Cepat & Stabil)
RUN apt-get update && apt-get install -y ca-certificates curl gnupg \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
# 2. Install dependencies utama dengan apt-get
RUN apt-get update && apt-get install -y \
git \
libpng-dev \
libonig-dev \
libxml2-dev \
libpq-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libzip-dev \
zip \
unzip \
nodejs \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# 3. Install PHP Extensions (TERMASUK pgsql / pdo_pgsql)
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install pdo_mysql pdo_pgsql pgsql mbstring exif pcntl bcmath gd zip
# 4. Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www
# 5. Copy existing application directory contents
COPY . /var/www
# 6. Install dependencies
# (Hapus --no-dev sementara jika Anda mau testing dengan Error Page Laravel yang rapi)
RUN composer install --no-interaction --optimize-autoloader
# 7. Install & Build Frontend
RUN npm install
RUN npm run build
# 8. Set permissions
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache \
&& chmod -R 775 /var/www/storage /var/www/bootstrap/cache
# 9. Expose port 8000 and start php artisan serve
EXPOSE 8000
# artisan serve berjalan langsung
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]