Skip to content

linefusion/directus-container

Repository files navigation

Directus Docker Images

Alternative container image for Directus with support for extensions.

linefusion/directus:latest

Overview

This image is meant to be an "universal" image for Directus. It's currently not bound to any specific Directus version because it will install Directus in runtime rather than build time. It allows for running Directus containers with extensions installed without building your own images, but beware that this will greatly increase the bootstrap time of the container as the packages will be installed only when the container starts.

You can decrease the startup time if you mount /directus/packages to the host, because pnpm cache is configured to be stored there, and it's the recommended setup if you intend to run it in production.

Note that for production, it's still recommended to build your own image with the extensions installed (check ONBUILD tags), but if you can't and/or don't want to, at least make sure to mount the extensions directory to decrease the startup time after the first run as the pnpm cache lives there.

Features

"Alpha"

  • Install Directus in runtime
  • Install Directus extensions in runtime
  • Install additional packages in runtime
  • Flag to turn off automatic directus bootstrap execution
  • Flag to turn off automatic installation of optionalDependencies

Planned

  • Decrease the startup time
    • Only run installation process if there's a configuration change
    • Provide "container based extensions" to compose the server installation
    • Anything that would decrease the startup time
  • Building custom images with extensions
  • Native support for different registries
  • Native support for git repositories
  • Native support for npm packages

Configuration

The image can be configured using environment variables.

Name Type/Format Default
DIRECTUS_VERSION NPM range or latest "latest"
DIRECTUS_BOOTSTRAP_ENABLED Boolean. "true" or "false" "true"
DIRECTUS_PACKAGES_ENABLED Boolean. "true" or "false" "true"
NODE_PACKAGES String or Object. undefined

DIRECTUS_VERSION

Value Default
NPM range or latest "latest"

The Directus version to use. Note that "latest" doesn't mean the latest released version of Directus, but the one this repository knows about, because the dependency tree is being cached to avoid external lookups and to speed up the build process.

DIRECTUS_BOOTSTRAP_ENABLED

Value Default
Boolean. "true" or "false" "true"

Turning this off (false) increases startup time but won't migrate your database if you are running a newer version on an older database.

Note that this is enabled by default in the official Directus image.

DIRECTUS_PACKAGES_ENABLED

Value Default
Boolean. "true" or "false" "true"

Whether to install all the defined optionalDependencies from @directus/api package, which includes database drivers and storage access.

Note that this is enabled by default in the official Directus image.

NODE_PACKAGES

Value Default
List of packages to install. ""

This can be used to install additional packages. It can be a string or a JSON object. If it's a string, you must separate each package with , and each package can contain the specific version you want to install. If the version isn't specified, it will use latest instead.

If it's a JSON object, it follows the same format as the package.json dependencies file format.

Examples

NODE_PACKAGES='my-dependency,my-dependency2@^4.2.3'
NODE_PACKAGES='{"my-dependency":"latest","my-dependency2":"^4.2.3"}'