Files
sidata/Dockerfile
T
2026-08-27 02:14:30 +00:00

78 lines
2.5 KiB
Docker

# =========================================================
# 1. APPLICATION STAGE (Single Stage untuk Lingkungan Offline)
# =========================================================
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/*
# Salin Composer binary dari registry lokal jika sewaktu-waktu butuh dump-autoload
COPY --from=10.15.39.186:8084/library/composer:2.7 /usr/bin/composer /usr/bin/composer
WORKDIR /var/www
RUN composer i
# PERBAIKAN: Gunakan skema copy offline dari aplikasi sukses,
# tetapi tambahkan flag chown untuk mencegah error Permission Denied (Error 500) pada Pod
COPY --chown=www-data:www-data . .
# 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
# 1. Buat folder storage LENGKAP (termasuk storage/logs)
# 2. Buat file log default laravel.log
# 3. Tetapkan izin akses www-data secara menyeluruh ke root aplikasi
RUN mkdir -p \
/var/www/storage/framework/sessions \
/var/www/storage/framework/views \
/var/www/storage/framework/cache \
/var/www/storage/logs \
/var/www/bootstrap/cache \
&& touch /var/www/storage/logs/laravel.log \
&& chown -R www-data:www-data /var/www \
&& chmod -R 775 /var/www/storage /var/www/bootstrap/cache
# Bersihkan cache konfigurasi lama agar tidak menyebabkan error 500 saat pod dinyalakan
RUN php /var/www/artisan config:clear || true
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;'"]