Issue Resolved
Issue #30 closed: Pre-built Laravel base images for faster deployments
Problem
Docker builds for Laravel apps on Coolify take 10-15 minutes because every deployment:
- Installs system dependencies via apt-get (~2-3 min)
- Compiles PHP extensions from source (gd, intl, pdo_pgsql, redis, etc.) (~2-3 min)
- Installs Node.js dependencies (~1-2 min)
This happens on every single deploy, even when dependencies haven't changed.
Proposal
Create and maintain official pre-built base images that laravel-coolify uses by default:
# Instead of this (slow)
FROM php:8.3-fpm-bookworm
RUN apt-get update && apt-get install -y libpq-dev libzip-dev ...
RUN docker-php-ext-install pdo pdo_pgsql zip gd mbstring ...
# Use this (fast)
FROM ghcr.io/stumason/laravel-coolify-base:8.3
# Extensions already installed, just copy your app
Suggested Base Images
| Image | PHP | Extensions | Use Case |
|---|---|---|---|
laravel-coolify-base:8.3 | 8.3 | pdo_pgsql, pdo_mysql, redis, gd, intl, zip, bcmath, opcache, pcntl | Standard Laravel |
laravel-coolify-base:8.4 | 8.4 | Same as above | PHP 8.4 early adopters |
laravel-coolify-base:8.3-node | 8.3 | Above + Node 20 LTS | SSR / full-stack builds |
Implementation Plan
- Base Dockerfile in this repo under
docker/base/ - GitHub Actions workflow for:
- Nightly builds to pick up security patches
- Triggered rebuilds when Dockerfile changes
- Multi-arch builds (amd64 + arm64)
- Automated testing - verify extensions load correctly
- Update laravel-coolify templates to use these images
Expected Results
- Deploy times drop from ~12 min to ~2-3 min
- Consistent, tested PHP environments
- Security patches applied automatically via nightly builds
- Less bandwidth usage (base image cached on Coolify servers)
Notes
- No Chromium/Browsershot - that's app-specific, users can extend the base
- Images published to GHCR (free for public repos)
- Semantic versioning:
8.3,8.3.x,8.3-20240115tags
This came from optimizing the Progress portfolio site where deploys were taking 12+ minutes. Happy to help implement this.