joshmeads / docker-craftcms

Docker image for Craft CMS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-craftcms

Docker image for Craft CMS. Available on Docker Hub as blackpepper/craftcms.

Usage

First start a MySQL database for Craft:

docker run --name database \
	-e MYSQL_ROOT_PASSWORD=password \
	-e MYSQL_USER=craft \
	-e MYSQL_PASSWORD=password \
	-e MYSQL_DATABASE=craft \
	-d mariadb:10

Then run Craft:

docker run --name craftcms \
	-e DB_SERVER=database \
	-e DB_USER=craft \
	-e DB_PASSWORD=password \
	-e DB_DATABASE=craft \
	-e DB_DRIVER=mysql \
	--link database \
	-p 8080:80 \
	-d blackpepper/craftcms

Visit http://localhost:8080/admin to create a site.

Docker Compose

Alternatively use Docker Compose:

version: '2.4'

services:
  
  craftcms:
    image: blackpepper/craftcms
    environment:
      DB_SERVER: database
      DB_USER: craft
      DB_PASSWORD: password
      DB_DATABASE: craft
      DB_DRIVER: mysql
    links:
      - database
    ports:
      - 8080:80

  database:
    image: mariadb:10
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_USER: craft
      MYSQL_PASSWORD: password
      MYSQL_DATABASE: craft
    ports:
      - 3306:3306

See the demo project to see this in action.

Tags

The following Docker image tags are available:

Craft Version Tag
3 latest
2 2

Configuration

Use the following environment variables to configure Craft at runtime:

Variable Name Craft Setting
DB_DRIVER driver
DB_SERVER server
DB_PORT port
DB_DATABASE database
DB_USER user
DB_PASSWORD password
CRAFT_ALLOW_UPDATES allowUpdates
CRAFT_COOLDOWN_DURATION cooldownDuration
CRAFT_DEV_MODE devMode
CRAFT_ENABLE_TEMPLATE_CACHING enableTemplateCaching
CRAFT_MAX_UPLOAD_FILE_SIZE maxUploadFileSize
CRAFT_OMIT_SCRIPT_NAME_IN_URLS omitScriptNameInUrls
CRAFT_PHP_MAX_MEMORY_LIMIT phpMaxMemoryLimit
CRAFT_SITE_URL siteUrl
CRAFT_TRANSFORM_GIFS transformGifs
CRAFT_USE_COMPRESSED_JS useCompressedJs
CRAFT_USER_SESSION_DURATION userSessionDuration

Customisation

Use as a base image to customise Craft templates and public assets:

FROM blackpepper/craftcms

COPY public /var/www/web
COPY templates /var/www/templates

Version

This image aspires to track the latest build of Craft CMS 3.0. Use the following build arguments to customise the Craft CMS version at build time:

Argument Description
CRAFT_VERSION The major and minor version, e.g. 3.0
CRAFT_BUILD The build number, e.g. 18

For example, to build an image for Craft CMS version 3.0.18:

docker build --build-arg CRAFT_VERSION=3.0 --build-arg CRAFT_BUILD=18 .

About

Docker image for Craft CMS.


Languages

Language:PHP 55.7%Language:Dockerfile 44.3%