use octane & frankenphp for docker image

This commit is contained in:
yuriko 🦊 2025-05-25 01:46:16 -04:00
parent 76d4b9eba3
commit fc9f0787a0
7 changed files with 249 additions and 50 deletions

View file

@ -1,28 +1,23 @@
# Stage 1: Build
FROM joseluisq/php-fpm:8.4 AS build
FROM dunglas/frankenphp
RUN apk add --no-cache nodejs npm
# Copy php.ini
COPY ./deploy/php.ini $PHP_INI_DIR/php.ini
WORKDIR /var/www/html
COPY --chown=www-data:www-data . .
RUN apt update -y && apt install -y git nodejs npm
COPY --from=composer:lts /usr/bin/composer /usr/bin/composer
RUN chmod -R 775 /var/www/html/storage \
&& chmod -R 775 /var/www/html/bootstrap/cache
RUN install-php-extensions \
gd \
opcache \
redis \
mongodb
RUN composer install --no-dev --prefer-dist \
&& npm install \
&& npm run build
COPY . /app
RUN chown -R www-data:www-data /var/www/html/vendor \
&& chmod -R 775 /var/www/html/vendor
RUN cp .env.example .env
RUN sed -i'' -e 's/^APP_ENV=.*/APP_ENV=production/' -e 's/^APP_DEBUG=.*/APP_DEBUG=false/' .env
# Stage 2: Deploy
FROM joseluisq/php-fpm:8.4
RUN composer install --ignore-platform-reqs --no-dev -a
RUN npm install && npm run build
COPY --from=build /var/www/html /var/www/html
WORKDIR /var/www/html
VOLUME ["/var/www/html/storage/app"]
EXPOSE 9000
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=9000", "--tries=1"]
ENTRYPOINT ["php", "artisan", "octane:frankenphp", "--host=0.0.0.0"]