@@ -23,7 +23,7 @@ RUN docker-php-serversideup-set-id www-data "$USER_ID":"$GROUP_ID" && \
2323
2424WORKDIR /var/www/html
2525COPY --chown=www-data:www-data composer.json composer.lock ./
26- RUN composer install --no-dev --no-interaction --no-plugins --no-scripts --prefer-dist
26+ RUN composer install --no-dev --no-interaction --no-plugins --no-scripts --prefer-dist --optimize-autoloader --classmap-authoritative
2727
2828USER www-data
2929
@@ -42,15 +42,23 @@ RUN npm run build-only && \
4242 rm -rf node_modules
4343
4444# =================================================================
45- # 2.5: Puppeteer / Chromium Builder Stage
45+ # 2.5: Puppeteer / Dependencies
4646# =================================================================
4747FROM node:23-slim AS puppeteer
4848
49- WORKDIR /puppeteer
49+ WORKDIR /app
5050
51- RUN npm install puppeteer --omit=dev
51+ # RUN npm install puppeteer --production && npm cache clean --force
52+ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
5253
53- RUN npx puppeteer install --chromium-skip-download=false
54+ RUN npm install puppeteer && \
55+ npm prune --omit=dev && \
56+ npm cache clean --force
57+
58+ # ENV PUPPETEER_CACHE_DIR=/app/puppeteer-cache
59+
60+ # RUN npm install puppeteer && npm prune --omit=dev \
61+ # && npx puppeteer browsers install chrome
5462
5563# =================================================================
5664# 3: Compile Laravel Image
@@ -76,15 +84,16 @@ RUN apk add --no-cache gnupg && \
7684 && apk add --no-cache \
7785 exiftool \
7886 ffmpeg \
79- git \
80- vim \
87+ chromium \
88+ nss \
89+ freetype \
90+ # freetype-dev \
91+ harfbuzz \
92+ ca-certificates \
93+ ttf-freefont \
8194 nodejs \
82- npm
83-
84- # Useful shell aliases
85- # RUN echo "alias ll='ls -al'" >> /etc/profile && \
86- # echo "alias a='php artisan'" >> /etc/profile && \
87- # echo "alias logs='tail -f storage/logs/laravel.log'" >> /etc/profile
95+ npm && \
96+ rm -rf /var/cache/apk/*
8897
8998# Configure PHP
9099COPY docker/etc/php/conf.d/zzz-custom-php.ini /usr/local/etc/php/conf.d/zzz-custom-php.ini
@@ -104,9 +113,17 @@ COPY storage/app/public/thumbnails/default.webp /var/www/html/storage/app/public
104113# Copy dependencies
105114COPY --from=composer --chown=www-data:www-data /var/www/html/vendor ./vendor
106115COPY --from=builder --chown=www-data:www-data /var/www/html/public/build ./public/build
107- COPY --from=puppeteer /puppeteer/node_modules ./node_modules
116+ COPY --from=puppeteer /app/node_modules ./node_modules
117+ # COPY --from=puppeteer /app/puppeteer-cache /home/www-data/.cache/puppeteer
108118COPY --chown=www-data:www-data . .
109119
120+ # ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
121+ # RUN npm install puppeteer && \
122+ # npm prune --omit=dev && \
123+ # npm cache clean --force
124+
125+ # RUN chmod -R +x /var/www/html/puppeteer-cache/
126+
110127RUN composer dump-autoload \
111128 && chmod o+w ./storage/ -R
112129# RUN chmod o+w ./public/ -R
@@ -119,7 +136,10 @@ RUN chmod -R 755 /var/www/html/.env
119136# COPY docker/etc/nginx/site-opts.d/http.conf /etc/nginx/site-opts.d/http.conf
120137COPY docker/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
121138RUN chown -R www-data:www-data /etc/nginx && \
122- chmod -R 755 /etc/nginx
139+ chmod -R 755 /etc/nginx && \
140+ rm -rf /tmp/* /root/.npm /root/.cache /home/www-data/.cache /usr/share/man /usr/share/doc /var/cache/apk/*
141+
142+
123143
124144ENV AUTORUN_ENABLED=true
125145ENV AUTORUN_LARAVEL_CONFIG_CACHE=false
@@ -133,6 +153,3 @@ ENV AUTORUN_LARAVEL_CONFIG_CACHE=false
133153VOLUME [ "/var/www/html/storage" ]
134154
135155USER www-data
136-
137- # ENTRYPOINT ["/var/www/html/docker/entrypoint.sh"]
138- # CMD ["php-fpm"]
0 commit comments