GWibisono

dockerfile (backend)

Apr 18th, 2026
117
0
Never
7
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GetText 1.44 KB | Software | 0 0
  1. # Menggunakan image PHP 8.2 FPM berbasis Alpine
  2. #FROM php:8.2-fpm-alpine
  3. FROM php:8.4-fpm
  4.  
  5. # 1. Update repository dan install dependency menggunakan apt-get
  6. RUN apt-get update && apt-get install -y \
  7.     nginx \
  8.     libpng-dev \
  9.     libjpeg62-turbo-dev \
  10.     libfreetype6-dev \
  11.     libwebp-dev \
  12.     libcurl4-openssl-dev \
  13.     libxml2-dev \
  14.     && rm -rf /var/lib/apt/lists/*
  15.  
  16. # 2. Konfigurasi dan Install ekstensi PHP
  17. # Perhatikan: Pada Debian, nama library sedikit berbeda dibanding Alpine
  18. RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \
  19.     && docker-php-ext-install -j$(nproc) \
  20.     pdo \
  21.     pdo_mysql \
  22.     mysqli \
  23.     gd \
  24.     curl \
  25.     bcmath \
  26.     ctype
  27.    
  28. # Pastikan folder log bisa ditulis oleh www-data
  29. RUN chown -R www-data:www-data /var/log/nginx && \
  30.     chown -R www-data:www-data /var/lib/nginx
  31.    
  32. # Buat direktori untuk aplikasi
  33. WORKDIR /var/www/html
  34.  
  35. # Salin konfigurasi Nginx custom ke dalam image
  36. #COPY ./configs/def.conf /etc/nginx/http.d/default.conf
  37. COPY ./configs/def.conf /etc/nginx/sites-available/default
  38. RUN ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
  39.  
  40. # Salin file source code (opsional, bisa juga via volume)
  41. COPY ./example /var/www/html
  42. RUN chown -R www-data:www-data /var/www/html && chmod -R 755 /var/www/html
  43.  
  44. # Ekspos port 80
  45. EXPOSE 80
  46.  
  47. # Jalankan PHP-FPM dan Nginx secara bersamaan
  48. CMD ["sh", "-c", "php-fpm -D && nginx -g 'daemon off;'"]
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment