Skip to content

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.

Notifications You must be signed in to change notification settings

TheRealMkadmi/docker-laravel-prod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Octane Production Base Image

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.

Features

Rationale

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.

Getting Started

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

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Feel free to submit a pull request or open an issue for suggestions or improvements.

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published