Created
November 3, 2024 18:18
-
-
Save mikefrancis/4d2941411db420a4a8bea19891cc5f9a to your computer and use it in GitHub Desktop.
Laravel FrankenPHP Render
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM node:lts-slim AS frontend-builder | |
| WORKDIR /app | |
| ADD package.json /tmp/package.json | |
| RUN cd /tmp && npm install | |
| RUN cp -a /tmp/node_modules /app/ | |
| COPY . . | |
| RUN npm run build | |
| FROM dunglas/frankenphp AS base | |
| ENV SERVER_NAME=:80 | |
| RUN install-php-extensions \ | |
| pdo_pgsql \ | |
| gd \ | |
| intl \ | |
| zip \ | |
| opcache | |
| RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | |
| COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | |
| WORKDIR /app | |
| COPY . . | |
| RUN --mount=type=cache,target=/tmp/cache composer install --no-interaction --no-scripts --no-suggest | |
| # RUN php artisan config:cache | |
| RUN php artisan route:cache | |
| RUN php artisan migrate --force | |
| # RUN php artisan optimize | |
| # Copy frontend assets | |
| COPY --from=frontend-builder /app/public /app/public | |
| # Line below needed otherwise build exits with a permissions error | |
| RUN setcap -r /usr/local/bin/frankenphp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment