Customized FrankenPHP Docker Image for Laravel
4.9K
This customized FrankenPHP Docker image is designed to run Laravel efficiently and is production-ready.
⚠️ latest and alpine tags using PHP 8.5
8.2, 8.3, 8.4, 8.5 (different tag)intlpcntlpdo_mysqlpdo_pgsqlrediszipInstall composer dependencies:
docker run --rm -it -v $PWD:/app composer:latest install
Or using this image:
docker run --rm -it -v $PWD:/app arifnd/frala composer install
Or if you have composer installed locally:
composer install
Run the project:
docker run -p 8000:80 \
-v $(pwd):/app \
arifnd/frala
Dockerfile (Project-Level)You can extend the base image to install dependencies and optimize the build:
FROM arifnd/frala
# Be sure to replace "your-domain-name.example.com" by your domain name
# ENV SERVER_NAME=your-domain-name.example.com
# If you want to disable HTTPS, use this value instead:
ENV SERVER_NAME=:80
WORKDIR /app
COPY . .
RUN composer install \
--prefer-dist \
--no-progress \
--no-interaction \
--no-dev \
--optimize-autoloader \
&& php artisan optimize \
&& chown -R www-data:www-data /app \
&& chmod -R 755 /app/storage /app/bootstrap/cache
Then build and run:
docker build -t my-laravel-app .
docker run -p 8000:80 my-laravel-app
compose.yaml (Docker Compose)services:
app:
image: arifnd/frala
ports:
- "8000:80"
volumes:
- .:/app
environment:
- APP_ENV=local
- APP_DEBUG=true
- SERVER_NAME=:80
You can serve Laravel in worker mode using Octane with the compose.yaml file below.
services:
frankenphp:
image: arifnd/frala
entrypoint: php artisan octane:frankenphp --workers=1 --max-requests=1
ports:
- "8000:8000"
environment:
- APP_ENV=local
- APP_DEBUG=true
- SERVER_NAME=:80
volumes:
- .:/app
See the full documentation for FrankenPHP via Docker.
If you want to build your own image, you can use the Dockerfile below:
FROM dunglas/frankenphp
# Enable PHP production settings
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# add additional extensions here:
RUN install-php-extensions \
@composer \
intl \
pcntl \
pdo_mysql \
pdo_pgsql \
redis \
zip
Content type
Image
Digest
sha256:e59a5ccc4…
Size
221.1 MB
Last updated
2 days ago
docker pull arifnd/frala