-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (51 loc) · 1.51 KB
/
Copy pathDockerfile
File metadata and controls
59 lines (51 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FROM php:8.3-fpm-alpine
ARG USER_ID=1000
ARG GROUP_ID=1000
# System deps + PHP extension build deps in ONE layer for maximum cache reuse
# ffmpeg is needed for video processing in both web and queue contexts
RUN apk add --no-cache \
ffmpeg \
libpng \
libzip \
oniguruma \
libxml2 \
icu-libs \
&& apk add --no-cache --virtual .build-deps \
libpng-dev \
libzip-dev \
oniguruma-dev \
libxml2-dev \
icu-dev \
$PHPIZE_DEPS \
&& docker-php-ext-install -j$(nproc) \
pdo_mysql \
mbstring \
exif \
pcntl \
bcmath \
gd \
zip \
opcache \
intl \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& apk del .build-deps \
&& rm -rf /tmp/pear /var/cache/apk/*
# Composer binary only
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Non-root user
RUN addgroup -g ${GROUP_ID} appgroup \
&& adduser -u ${USER_ID} -G appgroup -D appuser \
&& mkdir -p /var/log/php \
&& chown appuser:appgroup /var/log/php
WORKDIR /var/www/html
# In dev, code is bind-mounted so we skip COPY and composer install.
# Just ensure storage/bootstrap dirs exist with correct permissions.
RUN mkdir -p storage/framework/{cache,sessions,views} \
&& mkdir -p storage/logs \
&& mkdir -p bootstrap/cache \
&& chown -R appuser:appgroup storage bootstrap/cache \
&& chmod -R 775 storage bootstrap/cache
USER appuser
EXPOSE 9000
CMD ["php-fpm"]