Stu Mason
Stu Mason

Activity

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:

  1. Installs system dependencies via apt-get (~2-3 min)
  2. Compiles PHP extensions from source (gd, intl, pdo_pgsql, redis, etc.) (~2-3 min)
  3. 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

ImagePHPExtensionsUse Case
laravel-coolify-base:8.38.3pdo_pgsql, pdo_mysql, redis, gd, intl, zip, bcmath, opcache, pcntlStandard Laravel
laravel-coolify-base:8.48.4Same as abovePHP 8.4 early adopters
laravel-coolify-base:8.3-node8.3Above + Node 20 LTSSSR / full-stack builds

Implementation Plan

  1. Base Dockerfile in this repo under docker/base/
  2. GitHub Actions workflow for:
    • Nightly builds to pick up security patches
    • Triggered rebuilds when Dockerfile changes
    • Multi-arch builds (amd64 + arm64)
  3. Automated testing - verify extensions load correctly
  4. 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-20240115 tags

This came from optimizing the Progress portfolio site where deploys were taking 12+ minutes. Happy to help implement this.