1- # Stage phpbuilder
1+ # Stage phpbuilder
22# Install php extensions and composer dependencies
3- FROM dunglas/frankenphp:php8.4 AS phpbuilder
3+ FROM dunglas/frankenphp:php8.4-alpine AS phpbuilder
44LABEL authors="rohsyl"
55ARG USER=www-data
66ENV SERVER_NAME="http://"
7- RUN install-php-extensions \
8- pcntl pdo_mysql curl yaml \
9- gd mbstring \
10- intl xml bcmath \
11- zip intl readline redis sockets && \
12- pecl install excimer && \
13- mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
7+
8+ RUN apk add --no-cache \
9+ shadow \
10+ libcap \
11+ && install-php-extensions \
12+ pcntl pdo_mysql curl yaml \
13+ gd mbstring \
14+ intl xml bcmath \
15+ zip intl readline redis sockets && \
16+ mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
17+
1418COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
15- RUN useradd -D -d /app ${USER} && \
16- setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp; \
19+
20+ RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp && \
1721 chown -R ${USER}:${USER} /data/caddy /config/caddy /app && \
1822 chmod 775 /app
23+
1924WORKDIR /app
2025USER ${USER}
26+
2127COPY --chown=${USER}:${USER} composer.json composer.lock ./
2228RUN composer install --no-autoloader
29+
2330COPY --chown=${USER}:${USER} . .
31+
2432RUN mkdir -p storage/framework/sessions && \
2533 mkdir -p storage/framework/cache && \
2634 mkdir -p storage/framework/views && \
@@ -29,12 +37,14 @@ RUN mkdir -p storage/framework/sessions && \
2937 chmod -R 775 storage/logs && \
3038 chmod -R 775 storage/framework
3139
32- # Stage : app
40+ # Stage: app
3341# Build the app with needed composer dependencies, add assets dependencies
34- # and run laravel octane to serve the ap
42+ # and run Laravel Octane to serve the app
3543FROM phpbuilder AS app
44+
3645RUN composer dump-autoload -o && \
3746 php artisan optimize
47+
3848EXPOSE 8000
3949ENTRYPOINT ["php" , "/app/artisan" , "octane:frankenphp" ]
4050HEALTHCHECK --start-period=5s --interval=10s --timeout=5s --retries=8 CMD php /app/artisan octane:status || exit 1
0 commit comments