No description
  • JavaScript 54.2%
  • PHP 45.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-24 05:00:46 +00:00
bin init 2022-09-06 12:09:22 +02:00
config init 2022-09-06 12:09:22 +02:00
docker feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image 2026-10-23 12:23:59 +02:00
docs/agents feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image 2026-10-23 12:23:59 +02:00
logs init 2022-09-06 12:09:22 +02:00
migrations fix(image): replace Swift Mailer, drop GraphQL, close token forgery 2026-10-23 16:59:08 +02:00
packages fix(image): replace Swift Mailer, drop GraphQL, close token forgery 2026-10-23 16:59:08 +02:00
public feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image 2026-10-23 12:23:59 +02:00
src fix(image): replace Swift Mailer, drop GraphQL, close token forgery 2026-10-23 16:59:08 +02:00
.dockerignore feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image 2026-10-23 12:23:59 +02:00
.gitignore feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image 2026-10-23 12:23:59 +02:00
AGENTS.md feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image 2026-10-23 12:23:59 +02:00
composer.json fix(image): replace Swift Mailer, drop GraphQL, close token forgery 2026-10-23 16:59:08 +02:00
composer.lock fix(image): replace Swift Mailer, drop GraphQL, close token forgery 2026-10-23 16:59:08 +02:00
Dockerfile feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image 2026-10-23 12:23:59 +02:00
LICENSE.md feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image 2026-10-23 12:23:59 +02:00
README.md docs(readme): publish with a docker-container buildx builder 2026-10-24 06:52:01 +02:00
ws.toml feat(image): run the Directus 8.8.1 core on PHP 8.5 as a base image 2026-10-23 12:23:59 +02:00

directus-v8

Public base image holding the Directus 8.8.1 core (API and admin app), patched to run on PHP 8.5. Pienter's Directus 8 sites build FROM it and add only their own configuration, custom extensions, environment and upload paths.

PHP 7.4 gets no fix for php2shell (CVE-2026-109618, CVE-2026-109619); the fix shipped in PHP 8.5.12. This image keeps Directus 8.8.1, its database schema, public API and admin app unchanged, and moves the runtime to a patched PHP. Two things differ from stock Directus 8.8.1: the GraphQL endpoint (/<project>/gql) is removed and answers 404, and mail goes through Symfony Mailer instead of Swift Mailer (see Mail).

Image

git.pienter.space/pienter/directus-v8:<directus-version>-php<php-version>[-r<n>]
Tag Meaning
8.8.1-php8.5.12 Directus 8.8.1 core on php:8.5.12-apache-trixie
8.8.1-php8.5.12-r2, -r3, … Rebuild with the same Directus and PHP versions (core patch, dependency or Debian update)

Tags are immutable: never push to an existing tag. A new PHP release gets a new tag (for example 8.8.1-php8.5.13). Consumers pin a full tag in their FROM line and bump it deliberately.

The image contains:

  • php:8.5.12-apache-trixie with the extensions curl, exif, gd (freetype and jpeg), mbstring, mysqli, pdo_mysql, plus ffmpeg, git, unzip and Composer 2.10;
  • Apache with headers, rewrite and setenvif, document root /var/www/html/public (docker/apache-*.conf);
  • PHP settings from docker/php-directus.ini: variables_order = "EGPCS" (needed by DIRECTUS_USE_ENV), 50M uploads, and errors logged to the Apache error log instead of being displayed;
  • the Directus core at the project root /var/www/html: src/, packages/, bin/, migrations/, public/ (admin app, core auth extensions, API entry point), composer.json, composer.lock and vendor/;
  • empty logs/ and public/uploads/_/{originals,thumbnails} owned by www-data, and a HEALTHCHECK on /server/ping.

It contains no project configuration, secrets or custom extensions.

Consumer contract

Directus 8 resolves its base path from src/web.php, so the core stays at the image's project root and a consumer overlays its own files into the same tree. A consumer image copies only:

What Where in the image
Project configuration files, if the project does not run from environment variables config/
Custom extensions (endpoints, hooks, helpers, hashers, mail templates, …) public/extensions/custom/
Project environment defaults (storage paths, mail transport, CORS, …) ENV in the consumer Dockerfile; secrets come from the runtime environment
Upload directories, created and owned by www-data (usually mounted as a volume) under public/uploads/

A consumer must not copy or replace src/, packages/, vendor/, composer.json, composer.lock, public/index.php or public/admin/; those belong to this image.

Example consumer Dockerfile:

FROM git.pienter.space/pienter/directus-v8:8.8.1-php8.5.12

ENV DIRECTUS_STORAGE_ROOT=public/uploads/_/originals \
    DIRECTUS_STORAGE_ROOTURL=/uploads/_/originals \
    DIRECTUS_STORAGE_THUMBROOT=public/uploads/_/thumbnails

COPY config/ config/
COPY public/extensions/custom/ public/extensions/custom/

RUN chmod -R a+rX,u+w config public/extensions/custom \
    && mkdir -p public/uploads/_/originals public/uploads/_/thumbnails \
    && chown -R www-data:www-data public/uploads

Notes for consumers:

  • Permissions. Apache runs as www-data. Files copied from a checkout keep their mode; the chmod above makes them readable, otherwise Directus silently skips unreadable hooks and endpoints.
  • Environment. The image defaults to DIRECTUS_USE_ENV=1, DIRECTUS_ENV=production, a MySQL database on port 3306 (InnoDB, utf8mb4), local storage under public/uploads/_/ and secure cookies. Supply DIRECTUS_DATABASE_HOST, _NAME, _USERNAME, _PASSWORD, DIRECTUS_AUTH_SECRETKEY, DIRECTUS_AUTH_PUBLICKEY and the mail settings below at runtime, never in the image. A project that uses a config file (config/<project>.php) instead sets DIRECTUS_USE_ENV=0 and copies that file; keep secrets out of it (read them with getenv()).
  • Auth secret. DIRECTUS_AUTH_SECRETKEY (auth.secret_key) signs the HS256 tokens and must be at least 32 bytes. With a shorter secret the API still serves public reads, but every login, password reset request and invitation fails: login answers HTTP 500 with {"error":{"code":null,"message":"Provided key is too short"}} and logs DomainException: Provided key is too short in …/firebase/php-jwt/src/JWT.php; the password reset request answers HTTP 500 with error code 503 ("some issue when sending the mail"). Tokens issued with another secret are rejected with 401. Changing the secret logs every user out once.
  • Custom classes. Directus\Custom\Hooks\, \Helpers\, \Hasher\ and \Embed\Provider\ autoload through PSR-4 from public/extensions/custom/, so copied classes resolve without rebuilding the autoloader. Running composer dump-autoload --optimize --no-dev after the COPY is optional.
  • Libraries for custom code. Guzzle 7 (GuzzleHttp\Client), Symfony Mailer 7.4 and Mime (Symfony\Component\Mailer\…, …\Mime\Email), Twig 3, nyholm/psr7 and symfony/http-client are in the image. Swift Mailer (Swift_*) is not; send mail through the core mailer instead (see Mail). A project needing another library can add it in its own image with RUN composer require --update-no-dev <package>; prefer moving that need into the project's own code instead, because it re-resolves the lock inside the consumer build.
  • Development mode. DIRECTUS_ENV=development shows PHP errors in responses but hides PHP 8 deprecation notices, which Directus 8 raises in large numbers.

Mail

The core mailer (password reset, invitations, Directus\send_mail_* helpers) sends through Symfony Mailer over SMTP. Configure the default transport with the same keys Directus 8 always used, from the environment or from the mail section of a config file:

Environment variable Config file key Meaning
DIRECTUS_MAIL_DEFAULT_TRANSPORT mail.default.transport smtp (the environment default is sendmail, which the image does not ship, so always set it)
DIRECTUS_MAIL_DEFAULT_FROM mail.default.from Sender address, for example a verified SES identity
DIRECTUS_MAIL_DEFAULT_HOST mail.default.host SMTP host, for example email-smtp.eu-north-1.amazonaws.com
DIRECTUS_MAIL_DEFAULT_PORT mail.default.port SMTP port, for example 587
DIRECTUS_MAIL_DEFAULT_USERNAME mail.default.username SMTP user (secret, runtime only)
DIRECTUS_MAIL_DEFAULT_PASSWORD mail.default.password SMTP password (secret, runtime only)
DIRECTUS_MAIL_DEFAULT_ENCRYPTION mail.default.encryption tls: STARTTLS required (port 587); ssl: TLS from the first byte (port 465); empty: STARTTLS when the server offers it

For Amazon SES use port 587 with tls. The SES SMTP password is derived per region, so it only works against the host of the region it was issued for. mail.default.cc and mail.default.bcc (config file only) are still honoured.

Callbacks passed to send_mail_with_template(), send_mail_with_layout() and send_mail_with_content() receive a Directus\Mail\Message, which is a Symfony Email that also accepts the Swift style setters Directus 8 code uses: setSubject(), setFrom(), setTo(), setCc(), setBcc(), setReplyTo() (each taking 'email', ['email', …] or ['email' => 'Name', …], or an address and a name), setBody($body, 'text/html'|'text/plain') and addPart($body, 'text/plain'|'text/html'). Any other Symfony Email method works too. When the transport fails (connection, TLS, authentication), the core mailer logs the Symfony\Component\Mailer\Exception\TransportExceptionInterface and throws Directus\Mail\Exception\MailNotSentException instead. The password reset request, invitations and POST /mail then answer with the generic error code 503 ("some issue when sending the mail"); the SMTP reply never reaches the client.

What changed for PHP 8.5

Composer resolves for php ^8.5. Dependencies were bumped where a release compatible with the Directus 8 API exists, and patched in place where none does.

Package Change Why
guzzlehttp/guzzle 6.5.8 → 7.16 (psr7 2.13, promises 2.6) PHP 8.x support; fixes the 2022 and 2026 Guzzle and PSR-7 advisories; same Client API for Directus webhooks and project hooks
symfony/validator 3.4.47 → 5.4.54 PHP 8.x support and CVE-2024-50343; same constraint API Directus uses
cache/cache 1.0.0 replaced by the split cache/*-adapter 1.x packages, cache/adapter-common 1.3, cache/tag-interop 1.1 the monolith only allows PHP 5.6/7; the split packages hold the same classes
akrabat/ip-address-middleware 1.0.1 → 2.6.1 1.x only allows PHP 7; 2.x keeps the double-pass __invoke Slim 3 uses
zendframework/zend-stdlib removed abandoned and PHP 7 only; the zend-db fork used only PriorityList, now copied into packages/zend-db
twig/twig, slim/slim, league/*, symfony/validator and symfony/http-client 5.4, nyholm/psr7, pimple, ramsey/uuid, polyfills latest release in the existing constraint PHP 8.x fixes and advisories
swiftmailer/swiftmailer 5.4.12 replaced by symfony/mailer 7.4 (symfony/mime) Swift Mailer is abandoned and has an unfixed advisory; see Mail
webonyx/graphql-php 0.13.9 removed with the GraphQL endpoint fixes exist only in 15.x, which would need a rewrite of the endpoint
firebase/php-jwt 5.5.1 → 7.2 fixes CVE-2021-46743 and CVE-2025-45769; requires an auth secret of at least 32 bytes
robmorgan/phinx 0.9.2 → 0.16 (cakephp/database 5, symfony/console 8) drops the vulnerable symfony/yaml 4.4; migrations/migrations*.php set the feature_flags and InstallerUtils the table collation so installs create the same schema as Phinx 0.9
monolog/monolog 1.27 → 3.12 (psr/log 3) cakephp/database 5 needs psr/log 3, which Monolog 1 cannot implement
psr/simple-cache 1.0.1 → 2.0.0, required as 2.0.0 as 1.0.1 cakephp/datasource 5 needs 2.x while cache/adapter-common 1.3 declares ^1.0; 2.0 only adds parameter types, which the 1.x cache classes remain compatible with
league/flysystem 1.1.10 kept Directus 8 storage is written against the Flysystem 1 API

In-place patches:

  • packages/zend-db: allow PHP 8, drop zend-stdlib (src/Stdlib/PriorityList.php), delete the Float column stub (a reserved class name that cannot load on PHP 7 or 8), and cast vsprintf()/count() arguments in Sql/AbstractSql.php as PHP 7 did (PHP 8 throws TypeError).
  • packages/rate-limit: allow PHP 8. All four path packages declare "version": "dev-master" so resolution does not depend on the checkout's branch name.
  • src/core/Directus/Hook/Emitter.php: pass hook arguments positionally; PHP 8 treats string keys as named arguments.
  • src/core/Directus/Application/CoreServicesProvider.php: set PDO::ATTR_STRINGIFY_FETCHES so pdo_mysql keeps returning strings, as on PHP 7.
  • src/web.php: hide deprecation notices in development mode, and no /gql route (GraphQL removed: src/endpoints/GraphQL.php, src/core/Directus/GraphQL/, Services/GraphQLService.php).
  • src/core/Directus/Mail/: Symfony Mailer transports and a Swift compatible Message.
  • src/core/Directus/Util/JWTUtils.php: php-jwt 7 Key API.
  • migrations/upgrades/2019120216420{2,3}_*.php: call save() after drop(), which Phinx 0.16 no longer executes on its own.
  • The unused packages/directus-* copies of the core were deleted; the core loads from src/ only.

Security advisories that have no fix compatible with Directus 8 are ignored by ID in composer.json (config.policy.advisories.ignore-id), each with its reason, and remain visible in composer audit.

Build and publish

docker build -t git.pienter.space/pienter/directus-v8:8.8.1-php8.5.12 .

Publishing is a separate, explicit step after review. Build for the server architecture (and arm64 for local use) and push the immutable tag.

docker login takes your Forgejo username and an access token with the package: Read and Write scope (Settings → Applications). The default docker buildx driver cannot build several platforms at once, so create a docker-container builder once per machine:

docker login git.pienter.space
docker buildx create --name di-multi --driver docker-container --bootstrap

Check that the tag does not exist yet (tags are immutable), then push:

docker manifest inspect git.pienter.space/pienter/directus-v8:8.8.1-php8.5.12
docker buildx build \
    --builder di-multi \
    --platform linux/amd64,linux/arm64 \
    --tag git.pienter.space/pienter/directus-v8:8.8.1-php8.5.12 \
    --push .

The largest layer (ffmpeg, about 185 MB) takes longer than a minute to upload. Traefik on the tools server allows it through readTimeout: 600s on its websecure entry point (dokploy/dns/proxy.md); without it the push fails with 499 Client Closed Request.

After the first push, check that an anonymous docker pull of the tag works; the image must be public because the consumer builds pull it without credentials. An empty Docker config skips your login:

DOCKER_CONFIG="$(mktemp -d)" docker pull git.pienter.space/pienter/directus-v8:8.8.1-php8.5.12

Local run

docker run --rm -p 8080:80 \
    -e DIRECTUS_DATABASE_HOST=… -e DIRECTUS_DATABASE_NAME=… \
    -e DIRECTUS_DATABASE_USERNAME=… -e DIRECTUS_DATABASE_PASSWORD=… \
    -e DIRECTUS_AUTH_SECRETKEY=… -e DIRECTUS_AUTH_PUBLICKEY=… \
    -e DIRECTUS_COOKIE_SECURE=false \
    git.pienter.space/pienter/directus-v8:8.8.1-php8.5.12

The API answers on http://localhost:8080/_/, the admin app on http://localhost:8080/admin/.

License

Directus is GPL-3.0 software by RANGER Studio LLC; see LICENSE.md.