An opinionated base image for deploying Laravel applications in production, built with proven components. This image follows best practices to ensure security, performance, and maintainability.
- Laravel 11.x with support for the following first-party packages:
- PHP 8.4
- Nginx for serving static assets
- Supervisor for process management
Deploying Laravel applications often involves complex orchestration with multiple containers handling different tasks. However, many applications do not require this level of complexity. This base image provides a streamlined, efficient, and scalable solution by combining key components within a single container:
- Process Management: Supervisor efficiently runs workers and scheduled tasks.
- Performance Optimization: Octane significantly improves request handling speed.
- Static Asset Handling: Nginx serves static files with minimal overhead.
- Monitoring & Observability: Pulse offers real-time performance insights.
- Scalability: While optimized for a single-container deployment, it remains flexible enough to scale individual components when needed.
Use this template in your project with the following Dockerfile:
ARG WWWUSER=1000
ARG ROOT=/var/www/html
FROM therealmkadmi/laravel-octane-stack:latest
ARG WWWUSER
ARG ROOT
ENV ROOT=${ROOT}
WORKDIR ${ROOT}
COPY --link --chown=${WWWUSER}:${WWWUSER} composer.json composer.lock ./
RUN composer install --no-dev --no-scripts --no-progress --no-interaction
COPY --link --chown=${WWWUSER}:${WWWUSER} . .
RUN composer dump-autoload --optimize
RUN mkdir -p storage/framework/{sessions,views,cache,testing} storage/logs bootstrap/cache && \
chmod -R 777 storage bootstrap/cache ${ROOT}/public && \
chown -R ${WWWUSER}:${WWWUSER} . && \
chmod 777 storage/
ENV WITH_HORIZON=false \
WITH_SCHEDULER=true \
WITH_REVERB=false \
WITH_PULSE_WORK=true \
WITH_PULSE_CHECK=true \
WITH_ARTISAN_SCHEDULE=true
This project is licensed under the MIT License.
Contributions are welcome! Feel free to submit a pull request or open an issue for suggestions or improvements.