diff --git a/Dockerfile b/Dockerfile index f7bc278..3e83600 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,10 +18,10 @@ ENV HTTP_PROXY=${http_proxy} ENV HTTPS_PROXY=${https_proxy} # ========================================================= -# System dependencies +# System dependencies & Extensions # ========================================================= -RUN apt-get update && apt-get install -y \ +RUN apt-get update -o Acquire::Retries=5 && apt-get install -y --no-install-recommends --fix-missing \ nginx \ vim \ wget \ @@ -40,29 +40,25 @@ RUN apt-get update && apt-get install -y \ pdo \ pdo_mysql \ zip \ + && pecl install redis \ + && docker-php-ext-enable redis \ && rm -rf /var/lib/apt/lists/* # ========================================================= -# PEAR Proxy +# PEAR Proxy (jika diperlukan) # ========================================================= -RUN pear config-set http_proxy "http://10.15.3.20:80" +RUN pear config-set http_proxy "http://10.15.3.20:80" || true # ========================================================= -# Composer +# Composer setup & Caching Layer # ========================================================= WORKDIR /var/www -# ========================================================= -# Composer dependency -# Copy hanya composer files terlebih dahulu agar Docker cache -# ========================================================= - +# Copy file composer terlebih dahulu agar Docker Cache aktif COPY composer.json composer.lock ./ -COPY --chown=www-data:www-data . . - RUN composer install \ --no-dev \ --prefer-dist \ @@ -70,6 +66,9 @@ RUN composer install \ --no-scripts \ --optimize-autoloader +# Copy seluruh source code setelah composer install selesai +COPY --chown=www-data:www-data . . + # ========================================================= # Laravel directories & permission # ========================================================= @@ -86,7 +85,7 @@ RUN mkdir -p \ && chmod -R 775 /var/www/bootstrap/cache # ========================================================= -# Laravel cache +# Laravel cache cleanup # ========================================================= RUN php artisan config:clear || true \ @@ -130,14 +129,11 @@ RUN printf '%s\n' \ '}' \ > /etc/nginx/sites-available/default -RUN pecl install redis \ - && docker-php-ext-enable redis - RUN ln -sf /etc/nginx/sites-available/default \ /etc/nginx/sites-enabled/default # ========================================================= -# Remove proxy from runtime +# Clear Proxy Environment Variables from Runtime # ========================================================= ENV http_proxy="" @@ -146,13 +142,9 @@ ENV HTTP_PROXY="" ENV HTTPS_PROXY="" # ========================================================= -# Port +# Execution # ========================================================= EXPOSE 80 -# ========================================================= -# Start PHP-FPM + Nginx -# ========================================================= - -CMD ["sh", "-c", "php-fpm -D && exec nginx -g 'daemon off;'"] +CMD ["sh", "-c", "php-fpm -D && exec nginx -g 'daemon off;'"] \ No newline at end of file