Skip to content

Commit 43ae99e

Browse files
committed
feat: updated docker with full feature set
1 parent c4f7e5e commit 43ae99e

2 files changed

Lines changed: 51 additions & 22 deletions

File tree

Dockerfile

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN docker-php-serversideup-set-id www-data "$USER_ID":"$GROUP_ID" && \
2323

2424
WORKDIR /var/www/html
2525
COPY --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

2828
USER 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
# =================================================================
4747
FROM 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
9099
COPY 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
105114
COPY --from=composer --chown=www-data:www-data /var/www/html/vendor ./vendor
106115
COPY --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
108118
COPY --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+
110127
RUN 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
120137
COPY docker/etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
121138
RUN 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

124144
ENV AUTORUN_ENABLED=true
125145
ENV AUTORUN_LARAVEL_CONFIG_CACHE=false
@@ -133,6 +153,3 @@ ENV AUTORUN_LARAVEL_CONFIG_CACHE=false
133153
VOLUME [ "/var/www/html/storage" ]
134154

135155
USER www-data
136-
137-
# ENTRYPOINT ["/var/www/html/docker/entrypoint.sh"]
138-
# CMD ["php-fpm"]

docker-compose.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ services:
4747
caddy: ${APP_HOST:-app.test}
4848
caddy.reverse_proxy: '* {{upstreams 8080}}'
4949
networks:
50-
- mediaServer-db
51-
- default
50+
mediaServer-db:
51+
default:
52+
aliases:
53+
- app.test
5254
queue:
5355
<<: *app
5456
container_name: job_queue
@@ -65,6 +67,9 @@ services:
6567
healthcheck:
6668
test: ['CMD', 'healthcheck-queue']
6769
start_period: 10s
70+
networks:
71+
default:
72+
aliases: []
6873
event-queue:
6974
<<: *app
7075
container_name: event_queue
@@ -80,6 +85,9 @@ services:
8085
condition: service_healthy
8186
healthcheck:
8287
test: ['CMD', 'healthcheck-queue']
88+
networks:
89+
default:
90+
aliases: []
8391
scheduler:
8492
<<: *app
8593
container_name: laravel_scheduler
@@ -95,6 +103,9 @@ services:
95103
condition: service_healthy
96104
healthcheck:
97105
test: ['CMD', 'healthcheck-schedule']
106+
networks:
107+
default:
108+
aliases: []
98109
ws:
99110
<<: *app
100111
container_name: ws
@@ -115,8 +126,9 @@ services:
115126
healthcheck:
116127
test: ['CMD', 'healthcheck-schedule']
117128
networks:
118-
- default
119-
- mediaServer-db
129+
mediaServer-db:
130+
default:
131+
aliases: []
120132
caddy:
121133
image: 'caddy:2.9.1-alpine'
122134
container_name: caddy

0 commit comments

Comments
 (0)