Building an application FROM dmstr/phd5

Docker images from phd apps can also be used as base images, just by adding modules to the source code.

Visit dmstr/planck for an example.

Getting started


  • Download the planck repository.
  • :bulb: Edit the base image if your want to build from another pre-build application template.

See also guide


Copy .env-dist to .env and adjust project defaults.

Update Dockerfile with application default, like APP_NAME and APP_LANGUAGES.

See also guide

Initialize application

Run inital setup with demo data migrations

docker-compose run --rm \
    -e APP_MIGRATION_LOOKUP=@app/migrations/demo-data \
    php yii app/setup

Set admin password

docker-compose run --rm php yii user/password admin admin1

Create initial users

$ yii user/create dev Passw0rd
$ yii rbac/assign FrontendDeveloper dev
$ yii user/create editor Passw0rd
$ yii rbac/assign Editor editor

Start stack

docker-compose up -d

Open the application in your browser

open http://$DOCKER_HOST_IP:21080


Application environment variables

Persistent defaults should be set in Dockerfile

For runtime changes you can create a file under src/local.env.

edit src/local.env

Enable the host-volume by uncommenting services.php.volumes in

- ./src/local.env:/app/src/local.env

Create database migrations

make bash

$ yii migrate/create first

Adjust migration code

See also create migrations from files

Apply schema changes by running the migrations.

$ yii migrate

Create frontend module & database CRUD with schmunk42/yii2-giiant

See Code generation

Install additional packages

docker cp $(docker-compose ps -q php):/app/composer.json .

Edit run composer require or edit composer.json

composer update -vv

edit Dockerfile

docker-compose build

:exclamation: Running composer updates in a Docker container might be pretty slow if you are using host-volumes on OS X. See also: issue.

See also Composer update


cd tests
docker-compose up -d

Run tests

docker-compose run --rm php codecept run

See testing

Makefile support

Copy Makefile and Makefile.base from phd5.


Setup build


Enable Travis build

GitHub Services > Travis


DockerHub setup

Set ENV settings


GitLab setup


See also CI


curl -X POST \
  -F "ref=master" 
  -F "variables[TRIGGER_STACK_DIR]=demos/${TRAVIS_REPO_SLUG}" 

See also Environments

Help us to improve the documentation, fork this page.