Sign inSign up

agenziasmart/frankenphp-imageproc

By agenziasmart

•Updated 4 days ago

AgenziaSmart frankenphp-imageproc 8.3-alpine

Image
0

3.1K

agenziasmart/frankenphp-imageproc repository overview

⁠FrankenPHP 8.3 Image Processing

FrankenPHP 8.3 ottimizzato per image processing (resize, thumbnails, watermark) con GD e worker mode.

⁠Perché un'immagine dedicata?

AspettoSeparatoIntegrato in API
ScalingIndipendente (CPU-intensive)Scala con API (I/O-bound)
MemoryOttimizzato per GDCondivide con business logic
Failure isolationOOM non blocca APICrash totale
CDNCloudFront dedicatoCache mista

Pattern usato da: imgproxy, Thumbor, Imaginary.

⁠Estensioni Incluse

EstensioneDescrizione
gdImage processing (PNG, JPEG, WebP, GIF)
opcacheCache bytecode (JIT off di default)
zipCompressione (Composer)

Nota: Redis non incluso. ABS usa filesystem cache. Per rate limiting distribuito in futuro, considerare aggiunta.

⁠Tag Disponibili

TagDescrizioneUso
8.3-alpinePHP 8.3 su AlpineProduzione
8-alpineLatest PHP 8.x su AlpineDev/Staging
alpineLatest stableQuick tests

⁠Quick Start

docker pull agenziasmart/frankenphp-imageproc:8.3-alpine

# Test
docker run --rm -p 8080:8080 agenziasmart/frankenphp-imageproc:8.3-alpine

⁠Variabili d'Ambiente

VariabileDefaultDescrizione
SERVER_NAME:8080Hostname e porta
FRANKENPHP_CONFIGworker ./public/index.phpConfigurazione worker
MAX_REQUESTS500Richieste prima di restart worker

⁠Configurazione PHP

⁠Ottimizzazione per image processing (preconfigurato)
# Memory per elaborazione immagini
memory_limit=192M        # 128M + headroom per GD

# Execution time per resize grandi
max_execution_time=60

# OPcache ridotto (meno file da cachare)
opcache.memory_consumption=64
opcache.max_accelerated_files=2000
; JIT OFF di default — il tracing JIT ha miscompilato il container PHP-DI
; su PHP 8.5 ZTS in worker mode (incidente prod SW4 2026-07-13).
; OPcache resta ATTIVO: e' solo il JIT a essere spento.
opcache.jit=disable
opcache.jit_buffer_size=0
⁠Configurazione Custom (contratto ini)

Contratto ini. I file in /usr/local/etc/php/custom.d/ sono letti dopo quelli della base (conf.d) e vincono sempre, con qualunque nome di file: la priorita' dipende dalla directory (PHP_INI_SCAN_DIR), non dall'ordine alfabetico dei nomi. Non scrivere in conf.d/: e' territorio della base.

In un Dockerfile:

COPY docker/php/php.ini-prd /usr/local/etc/php/custom.d/php.ini

Riabilitare il JIT (solo se l'applicazione e' davvero CPU-bound in userland PHP, e l'hai misurato — su carichi I/O-bound il guadagno e' rumore statistico):

; in custom.d/php.ini — usa i preset documentati da PHP. MAI 1255.
opcache.jit = 1254            ; tracing (preset ufficiale)
opcache.jit_buffer_size = 64M

Oppure montando un file a runtime:

docker run -v ./my-config.ini:/usr/local/etc/php/custom.d/my-config.ini:ro \
  agenziasmart/frankenphp-imageproc:8.3-alpine

⁠Esempio docker-compose.yml

services:
  abs:
    image: agenziasmart/frankenphp-imageproc:8.3-alpine
    ports:
      - "8081:8080"
    volumes:
      - ./abs:/app
      - image_cache:/tmp/abs
    environment:
      - SERVER_NAME=:8080
      - MAX_REQUESTS=500

volumes:
  image_cache:

⁠Esempio ECS Task Definition

{
  "family": "abs-imageproc",
  "networkMode": "awsvpc",
  "requiresCompatibilities": ["FARGATE"],
  "cpu": "512",
  "memory": "1024",
  "containerDefinitions": [
    {
      "name": "abs",
      "image": "agenziasmart/frankenphp-imageproc:8.3-alpine",
      "portMappings": [
        {
          "containerPort": 8080,
          "protocol": "tcp"
        }
      ],
      "environment": [
        {"name": "SERVER_NAME", "value": ":8080"},
        {"name": "MAX_REQUESTS", "value": "500"}
      ],
      "healthCheck": {
        "command": ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"],
        "interval": 30,
        "timeout": 5,
        "retries": 3
      },
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "/ecs/abs-imageproc",
          "awslogs-region": "eu-west-1",
          "awslogs-stream-prefix": "ecs"
        }
      }
    }
  ]
}

⁠Integrazione con Intervention/Image

// composer require intervention/image

use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

$manager = new ImageManager(new Driver());

$image = $manager->read('photo.jpg')
    ->resize(800, 600)
    ->toWebp(quality: 85);

⁠Integrazione con League/Glide

// composer require league/glide

use League\Glide\ServerFactory;

$server = ServerFactory::create([
    'source' => '/path/to/source',
    'cache' => '/tmp/abs',
    'driver' => 'gd',  // usa GD, non Imagick
]);

$server->outputImage('photo.jpg', ['w' => 800, 'h' => 600, 'fm' => 'webp']);

⁠Health Check

Questa immagine non include un HEALTHCHECK integrato. Come le immagini ufficiali Docker (php, nginx, node), la configurazione degli health check è responsabilità del livello applicativo/orchestrazione.

⁠docker-compose.yml
services:
  abs:
    image: agenziasmart/frankenphp-imageproc:8.3-alpine
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s
⁠ECS Task Definition
"healthCheck": {
  "command": ["CMD-SHELL", "curl -f http://localhost:8080/health || exit 1"],
  "interval": 30,
  "timeout": 5,
  "retries": 3,
  "startPeriod": 10
}

Nota: Adatta la porta e il path (/health) alla configurazione della tua applicazione. Se usi SERVER_NAME=:80, il health check deve puntare a localhost:80.

⁠Verifica Estensioni

docker run --rm agenziasmart/frankenphp-imageproc:8.3-alpine php -m | grep -E 'gd|OPcache'

Output atteso:

OPcache
gd

⁠Verifica GD Capabilities

docker run --rm agenziasmart/frankenphp-imageproc:8.3-alpine php -r "print_r(gd_info());"

⁠Build Locale

cd images/frankenphp/8.3/imageproc
docker build -t frankenphp-imageproc:local .

⁠Licenza

MIT

Tag summary

Content type

Image

Digest

sha256:db1d76cc9…

Size

92.6 MB

Last updated

4 days ago

docker pull agenziasmart/frankenphp-imageproc:8.3-alpine-20261012