HUB
Sign inSign up
basephpcomposer logo

sinfallas/basephpcomposer

By sinfallas

•Updated 2 days ago

A PHP image with pdo_pgsql and composer

Image
Languages & frameworks
0

5.9K

sinfallas/basephpcomposer repository overview

⁠sinfallas/basephpcomposer

Docker Pulls Image Size Multi-Arch License: GPL-2.0-only QA-11X Rule Zero

⁠1. Purpose and Technical Summary

sinfallas/basephpcomposer is a multi-architecture (linux/amd64, linux/arm64), non-root (USER www, UID/GID 1000:1000) PHP-FPM & Composer base image for the QA-11X standard built on debian:trixie-slim with precompiled .deb packages from packages.sury.org/php. It supports arbitrary host UID overrides (-u "$(id -u):$(id -g)") and air-gapped execution (--network none --read-only --tmpfs /tmp:rw,exec,nosuid,nodev).

⁠2. Supported Tags and Architectures

TagPHP / Base OSArchitecturesNotes / Channel
latest, 8.5PHP 8.5 FPM (debian:trixie-slim + Sury)linux/amd64, linux/arm64Current QA-11X default (OPcache built-in)
8.4PHP 8.4 FPM (debian:trixie-slim + Sury)linux/amd64, linux/arm64Active supported branch
8.3PHP 8.3 FPM (debian:trixie-slim + Sury)linux/amd64, linux/arm64Active supported branch
8.2PHP 8.2 FPM (debian:trixie-slim + Sury)linux/amd64, linux/arm64Security maintenance branch

⁠3. Preinstalled Toolchain and PHP Extensions

  • QA & Dependency Tools: composer (v2), global phpstan and phpunit in /opt/qa11x/composer/vendor/bin (symlinked in /usr/local/bin), ca-certificates, curl, git, nano, unzip, wget, zip.
  • PHP Extensions: bcmath, curl, gd, intl, mbstring, pcntl, pcov, pdo, pdo_pgsql, pgsql, pdo_sqlite, sqlite3, redis, sockets, xml (dom, simplexml, xmlreader, xmlwriter), zip, Zend OPcache.
  • Hardened INI Configuration: Custom STIG/OWASP php.ini (expose_php=Off, display_errors=Off, strict HttpOnly/Secure/SameSite session cookies, OPcache JIT) plus /usr/local/etc/php/conf.d/qa-11x.ini (memory_limit=2G, pcov.enabled=1, pcov.directory=auto).

⁠4. Environment Variables, Ports, Permissions, and HEALTHCHECK

SettingDefault ValueDescription
USERwww (1000:1000)Non-root FPM & CLI user; compatible with -u "$(id -u):$(id -g)"
EXPOSE9000FastCGI PHP-FPM listener (daemonize=no, pid=/tmp/php-fpm.pid)
WORKDIR/var/wwwApplication workspace root
HOME / COMPOSER_HOME/tmp / /tmp/composerRead-only root filesystem safe temporary paths
PHP_INI_SCAN_DIR:/usr/local/etc/php/conf.dAppends qa-11x.ini overrides on top of distro php.ini
HEALTHCHECKphp-fpm -t and php -vInterval 30s, timeout 10s, retries 3

⁠5. Quickstart (docker run and docker-compose.yml)

⁠Offline PHPStan + PHPUnit + PCOV Cobertura Execution
docker run --rm --restart=no --network none --read-only \
  --tmpfs /tmp:rw,exec,nosuid,nodev \
  -u "$(id -u):$(id -g)" \
  -e HOME=/tmp \
  -e COMPOSER_HOME=/tmp/composer \
  -v "$(pwd):/var/www:ro" \
  -w /var/www \
  sinfallas/basephpcomposer:8.5 \
  bash -euo pipefail -c '
    phpstan analyse --no-progress
    php -d pcov.enabled=1 -d pcov.directory=src /opt/qa11x/composer/vendor/bin/phpunit --coverage-cobertura /tmp/cobertura.xml
  '
⁠Minimal docker-compose.yml Service
services:
  php-fpm:
    image: sinfallas/basephpcomposer:8.5
    restart: "no"
    read_only: true
    cap_drop:
      - ALL
    security_opt:
      - no-new-privileges:true
    tmpfs:
      - /tmp:rw,exec,nosuid,nodev
    environment:
      HOME: /tmp
      COMPOSER_HOME: /tmp/composer
      TZ: ${TZ:-UTC}
    ports:
      - "127.0.0.1:9000:9000"
    volumes:
      - .:/var/www:ro

⁠6. Local Build, Validation (example/), and Trivy Audit

All 4 PHP versions (8.2, 8.3, 8.4, 8.5 + latest) are orchestrated via docker-bake.hcl (validate + release matrix):

# Preview resolved Bake plan and audit Dockerfile IaC
./build.sh --print
./build.sh --check

# Build locally, run example/ (extensions, SQLite, GD, php.ini regression, PCOV >= 95%, negative PHPStan) + Trivy
./build.sh --local
./build.sh --local 8.5

# Validate without overwriting local tags
./build.sh --validate-only 8.5

# Verify linux/arm64 build and php-fpm / example/ runtime
./build.sh --arm64-check

# Run pinned Trivy image scan directly
docker run --rm --restart=no \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -v qa11x_trivy_cache:/root/.cache/trivy \
  aquasec/trivy:0.76.2@sha256:8f6bb947dbc528902e11f2f5be52f7b519f6a39d5d148f41166f2040499768fb \
  image --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 sinfallas/basephpcomposer:8.5

⁠7. Source Code, Support, Author, and License

Tag summary
Recent tags
Content type
Image
Digest
sha256:bda4ae43b…
Size
139.7 MB
Last updated
2 days ago
docker pull sinfallas/basephpcomposer:latest