/docker

Directus 7 Docker — Official Container for Directus

Primary LanguageShell

Directus Logo

 

The All-New Directus 7
Future-Proof Headless CMS

 

Warning: container support is HIGHLY experimental and we're still gathering feedback from the community. We can raise issues or ping us in #docker channel on Slack.

Overview

Directus provides several container images that will help we get started. Even though we maintain extra kinds, our officially supported image is based on php:apache. All our container images can be found in docker hub.

Concepts

This repository has several images in it that follows some organization concepts.

We've organized our docker images in a way that:

  • We do a better use of layer caching
  • We avoid as much code duplication on dockerfiles as possible
  • We can make security updates (os/webserver) without modifying application images code
  • We provide a easy way for the end user to extend images

Image kinds

We don't want to force anyone to use only apache and even though this is the one directus team officially supports, we know there are many webservers out there and we should be free to use the ones we like. We can also provide more slim versions of images by switching between OS distributions. For example: apache, nginx, caddy, alpine...

Our images are split into 3 image types:

  1. Dist images
  2. Base images
  3. Core images

In most cases, dist images are the ones you'll want to use to deploy your directus instances. They are distributed by directus team through docker hub under their respective repositories, so always start from dist images until you find out that you need further customization.

Image dependencies

To make final image builds faster, we share common steps through base and core images. Here's how we do that.

Example

Core

directus/core:1.2.3-apache

FROM php:7.3-apache
RUN apt-get update && apt-get install dependency
...

Base (api)

directus/base:1.2.3-api-apache

FROM directus/core:1.2.3-apache
RUN docker-php-ext-install extension
...

Dist (api)

directus/api:3.2.1-apache

FROM directus/base:1.2.3-api-apache
ONBUILD COPY . .
...

Dependency diagram

We'll cover below what each image does and when to use them.

Dist images

These are the images you'll likely want to use to deploy your instances.

Dist images are the images the directus team will build, support and distribute themselves and only contains the default configuration setup. Users will likely use these for their simple setups.

WARNING: These images ARE NOT built on this repository. They live inside their own repositories with their own release cycles.

FQIN

directus/${project}:${version}-${kind}

Example

Variable Value
project api
kind apache
version 3.2.1
directus/api:3.2.1-apache

Base images

These images are the base images used in project (FROM statements), they include everything a project need to run.

Every project has its own base images that inherits the core ones (allowing us to further customize the core with project-specific requirements).

For example if we're building an api image using apache, we will inherit the core image using FROM directus/base:VERSION-apache on the first line of its Dockerfile.

These base images are mostly used to simplify the project implementation by adding some ONBUILD steps and are meant for more advanced users.

We'll want to use them if we are building our own custom project images as they are ready to accept code from their ONBUILD stages.

Dockerfiles inheriting from this base images allows us to add our own extension/hooks and/or install more extensions to PHP.

FQIN

directus/base:${version}-${project}-${kind}

Example

Variable Value
project app
kind node
version 1.2.3
directus/base:1.2.3-app-node

Core images

These are the clean images, it doesn't include anything related to any directus project.

Core images are the images that contains only setup scripts and server related stuff, this allows us to have consistency over all projects whenever we make fixes and/or security updates are applied to webservers/OS.

These images DOES NOT contain any project-specific files besides webserver entrypoints and helper scripts related to the webserver itself, such as install and helper scripts.

The core images exists to be extended by base images (api, app, ...).

FQIN

directus/core:${version}-${kind}

Example

Variable Value
version 1.2.3
kind apache
directus/core:1.2.3-apache

Building

In most cases you'll not need to build anything in this repository because we already distribute built images through docker hub. But if you want to, you'll be able to easily build them with our build script.

Requirements


Executing the build script

We can build core images using the command build --type core.

Note: If you're getting "-A: invalid option" issues, try updating your bash console. OSX for example ships with older bash versions. These scripts will only work on bash 4 or newer.

# Clone the repository
git clone https://github.com/directus/docker.git

# Open the repository directory
cd docker

# Invoke build script
./bin/build --help

Sandbox

TODO: write about sandbox


Directus is released under the GPLv3 license. RANGER Studio LLC owns all Directus trademarks and logos on behalf of our project's community. Copyright © 2006-2019, RANGER Studio LLC.