Add new file

This commit is contained in:
izuddin
2026-08-26 05:58:47 +00:00
parent f7fc7d5ced
commit 4945b9728d
+83
View File
@@ -0,0 +1,83 @@
# =========================================================
# 1. COMPOSER STAGE (Untuk binary & vendor generation)
# =========================================================
FROM 10.15.39.186:8084/library/composer:2.7 AS composer
WORKDIR /app
# Salin file dependensi terlebih dahulu
COPY composer.json composer.lock ./
# Unduh/susun dependensi di stage composer (Gunakan cache/mirror lokal jika ada)
RUN composer install --no-dev --prefer-dist --no-scripts --no-autoloader --ignore-platform-reqs
# Salin sisa kode aplikasi ke stage composer
COPY . .
# Generate autoloader yang sudah dioptimasi
RUN composer dump-autoload --optimize --no-dev --no-plugins --no-scripts
# =========================================================
# 2. APPLICATION STAGE
# =========================================================
FROM 10.15.39.186:8083/php74-fpm-oci8-lengkap:1.0
ARG http_proxy
ARG https_proxy
ENV http_proxy=$http_proxy
ENV https_proxy=$https_proxy
# Install Nginx & Dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
nginx \
unzip \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /var/www
# Salin SELURUH source code BESERTA vendor yang sudah jadi dari stage composer
COPY --from=composer /app /var/www
# Hapus proxy dari environment runtime
ENV http_proxy=
ENV https_proxy=
# Setup Nginx Config
RUN echo 'server { \
listen 80; \
index index.php index.html; \
error_log /var/log/nginx/error.log; \
access_log /var/log/nginx/access.log; \
root /var/www/public; \
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; \
} \
location / { \
try_files $uri $uri/ /index.php?$query_string; \
gzip_static on; \
} \
}' > /etc/nginx/sites-available/default
# Setup direktori storage & bootstrap cache Laravel serta atur izin akses
RUN mkdir -p \
/var/www/storage/framework/sessions \
/var/www/storage/framework/views \
/var/www/storage/framework/cache \
/var/www/bootstrap/cache \
&& chown -R www-data:www-data /var/www \
&& chmod -R 775 /var/www/storage /var/www/bootstrap/cache
ENV APP_ENV=production
ENV APP_DEBUG=false
ENV DB_CONNECTION=dejos
EXPOSE 80
CMD ["sh", "-c", "php-fpm -D && exec nginx -g 'daemon off;'"]