initiate docker and ngix for render hosting
This commit is contained in:
parent
c9c095e0ee
commit
1a0f95d82b
|
|
@ -0,0 +1,47 @@
|
|||
# Menggunakan image PHP 8.2 FPM resmi
|
||||
FROM php:8.2-fpm
|
||||
|
||||
# Mengatur working directory
|
||||
WORKDIR /var/www
|
||||
|
||||
# Menginstal dependensi sistem dan ekstensi PHP yang dibutuhkan Laravel
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
libpng-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libfreetype6-dev \
|
||||
locales \
|
||||
zip \
|
||||
jpegoptim optipng pngquant gifsicle \
|
||||
vim \
|
||||
unzip \
|
||||
git \
|
||||
curl \
|
||||
libzip-dev \
|
||||
nginx
|
||||
|
||||
# Membersihkan cache
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Menginstal ekstensi PHP
|
||||
RUN docker-php-ext-install pdo_mysql zip exif pcntl
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
|
||||
RUN docker-php-ext-install gd
|
||||
|
||||
# Menginstal Composer secara langsung dari image resmi
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Menyalin seluruh kode proyek ke dalam kontainer
|
||||
COPY . /var/www
|
||||
|
||||
# Memberikan izin akses (permissions) ke folder storage dan cache
|
||||
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache
|
||||
|
||||
# Menyalin konfigurasi Nginx (akan kita buat di langkah berikutnya)
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Mengekspos port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Menjalankan script PHP-FPM dan Nginx secara bersamaan
|
||||
CMD service nginx start && php-fpm
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
index index.php index.html;
|
||||
server_name localhost;
|
||||
root /var/www/public;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue