/docker-compose-web

Minimal Docker compose configuration with php-fpm + nginx + mysql + mailhog (all are alpine latest) and an optional capistrano container

Primary LanguageDockerfile

Build Status

Docker Compose for WEB development

This docker-compose use php-fpm, nginx (HTTP+HTTPS/2), MySQL and Mailhog.

Quick start

Put this repository files in a .docker folder in/outside your project or put it a the root of it (default behaviour)

cp .env.dist .env
docker-compose up -d --build

Detailed using

Initialisation

Put this repository files in a .docker folder in/outside your project or put it a the root of it (default behaviour)

Environment vars

The first thing to do is to copy the .env.dist file to a .env file, then fill in the value you want to be changed.

cp .env.dist .env

Change the values in .env following the instructions in it

Build containers

The build process will first build nginx and add the necessary vhost, build composer+php-fpm together building and adding necessary php-extensions with configurations (with specific configuration by PROJECT_TYPE)

docker-compose build

Starting containers

All containers will be launch and ports will be available on loopback network

docker-compose up -d

Configuration by ${PROJECT_TYPE}

"symfony-flex"

This configuration has a specific php configuration and a vhost file. Plus, you can keep /var/* folders in the container to avoid some performances issues on Windows for exemple. If you want to use use this environement vars :

PROJECT_TYPE=symfony-flex
# If you want to add other php extensions, uncomment the line bellow
# multiple extensions should be seperated by a space
# APP_PHP_EXTRA_EXTENSIONS=exif

"symfony-1"

@TODO

"symfony-2"

This configuration has a specific php configuration and a vhost file. Plus, you can keep /app/* folders in the container to avoid some performances issues on Windows for example. If you want to use use this environment vars :

PROJECT_TYPE=symfony-2
NGINX_WEB_INDEX_FILE=app_dev.php
# If you want to add other php extensions, uncomment the line bellow
# multiple extensions should be seperated by a space
# APP_PHP_EXTRA_EXTENSIONS=exif

"drupal"

@TODO

"wordpress"

This configuration has a specific php configuration and a vhost file. If you want to use use this environment vars :

PROJECT_TYPE=wordpress
NGINX_WEB_FOLDER=
# If you want to add other php extensions, uncomment the line bellow
# multiple extensions should be seperated by a space
# APP_PHP_EXTRA_EXTENSIONS=exif

Certificate trusted on MACOSX

docker-compose -f ./.docker/docker-compose.yaml -f ./.docker/docker-compose.capistrano.yaml --env-file .env \
  cp nginx:/etc/ssl/certs/server-localhost.crt .docker/config/nginx/ssl/certs/server.crt
sudo security add-trusted-cert -d -r trustRoot ./.docker/config/nginx/ssl/certs/server.crt

Addons

Capistrano

Build it like this, your private ssh key have to in your ~/.ssh directory (or define an other ssh key directory to use) :

docker-compose -f ./docker-compose.capistrano.yaml build

Rq: bundle install is made on first up or every run if and only if a Gemfile is present at the root of ${PROJECT_DIR}

up and exe it (if you want to exec it many time this is better than only run) :

docker-compose -f ./docker-compose.capistrano.yaml up -d
docker-compose -f ./docker-compose.capistrano.yaml exec capistrano cap stagging deploy

or run it

docker-compose -f ./docker-compose.capistrano.yaml run capistrano cap stagging deploy

NodeJS

@TODO