├── Dockerfile ├── LICENSE ├── Makefile ├── README.md └── storage └── .gitignore /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.1-apache 2 | 3 | ARG BLD_PKGS="libfreetype6-dev libjpeg62-turbo-dev libpng12-dev postgresql-client libpq-dev libicu-dev" 4 | ARG PHP_EXTS="pdo pdo_pgsql pdo_mysql pgsql gd" 5 | 6 | MAINTAINER Jason McCallister 7 | 8 | # install needed items (php extensions) 9 | RUN apt-get update \ 10 | && apt-get install -y $BLD_PKGS \ 11 | && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ 12 | && docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \ 13 | && docker-php-ext-install $PHP_EXTS \ 14 | && pecl install intl \ 15 | && docker-php-ext-install intl 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Venveo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: craft build run ssh stop 2 | 3 | # Project information 4 | 5 | COMPANY := venveo 6 | PROJECT := docker-demo 7 | 8 | # Database information 9 | 10 | DB_USER := craftcms 11 | DB_PREFIX := dev 12 | DB_PASSWORD := CraftCMS1! 13 | MYSQL_VERSION := 5.7 14 | POSTGRES_VERSION := 9.5 15 | 16 | # Helpers 17 | 18 | MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST))) 19 | PWD := $(dir $(MAKEPATH)) 20 | 21 | craft: 22 | composer create-project craftcms/craft craft -s beta \ 23 | && rm craft/.env \ 24 | && mv craft/web craft/html 25 | 26 | build: 27 | docker build -t $(COMPANY)/$(PROJECT) . 28 | 29 | run: 30 | docker run --rm \ 31 | -d -p 3306:3306 \ 32 | -e MYSQL_USER=$(DB_USER) \ 33 | -e MYSQL_ROOT_PASSWORD=$(DB_PASSWORD) \ 34 | -e MYSQL_PASSWORD=$(DB_PASSWORD) \ 35 | -e MYSQL_DATABASE=$(DB_PREFIX)_$(PROJECT) \ 36 | -v $(PWD)storage/mysql:/var/lib/mysql/ \ 37 | --name $(PROJECT)-mysql mysql:$(MYSQL_VERSION) \ 38 | && docker run --rm \ 39 | -d -p 80:80 \ 40 | -e DB_DRIVER=mysql \ 41 | -e DB_SERVER=$(PROJECT)-mysql \ 42 | -e DB_USER=$(DB_USER) \ 43 | -e DB_PASSWORD=$(DB_PASSWORD) \ 44 | -e DB_DATABASE=$(DB_PREFIX)_$(PROJECT) \ 45 | -e DB_SCHEMA=public \ 46 | --link $(PROJECT)-mysql \ 47 | --volume $(PWD)craft:/var/www \ 48 | --name $(PROJECT)-craftcms $(COMPANY)/$(PROJECT) 49 | 50 | ssh: 51 | docker exec -it $(PROJECT)-craftcms bash 52 | 53 | stop: 54 | docker stop $(PROJECT)-craftcms $(PROJECT)-mysql 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker Build for Craft CMS 2 | 3 | Our starter project for Docker powered Craft CMS websites 4 | 5 | ## Installation 6 | 7 | 1. Clone the respository into the a new project (e.g `our-company-website`) 8 | 2. `cd` to `our-company-website` and run `make craft`. This will use composer to create new new Craft CMS project into the `craft` directory. This will also move the default `craft\web` directory to `craft\html` to ensure compatability with the official PHP Apache image 9 | 3. Open `Makefile` and change `COMPANY`, `PROJECT`, `DB_USER` and `DB_PASSWORD` to meet your requirements 10 | 4. Run `make build`. This will create a new Docker image using the Company and Project name (e.g venveo/new-project) 11 | 5. After the build completes, run the command `make run`. This will create three new containers. One for PHP Apache, Postgres and MySQL 12 | 6. Open up a browser and visit [http://localhost/index.php/admin/install](http://localhost/index.php/admin/install) 13 | 14 | ### Makefile 15 | 16 | #### make craft 17 | 18 | Uses composer to create a new Craft CMS inside the `craft` directory. 19 | 20 | #### make build 21 | 22 | Run the `docker build` command to create a new image for the Company/Project namespace. 23 | 24 | #### make run 25 | 26 | Run the Docker containers for the web and databases. 27 | 28 | #### make ssh 29 | 30 | Run `docker exec` to "ssh" into the webserver and drop you into a bash shell 31 | 32 | #### make stop 33 | 34 | Run `docker stop` on each container. 35 | 36 | ### To Dos 37 | 38 | 1. Setup Lets Encrypt for local HTTPS websites 39 | 2. Cleanup the `Makefile` to be able to select MySQL or Postgres as the database 40 | 3. Update and improve the documentation 41 | 42 | ## Credits 43 | 44 | * [Jason McCallister](https://github.com/themccallister) 45 | 46 | ## About Venveo 47 | 48 | Venveo is a Digital Marketing Agency for Building Materials Companies in Blacksburg, VA. Learn more about us on [our website](https://www.venveo.com). 49 | 50 | ## License 51 | 52 | The MIT License (MIT). Please see [License File](LICENSE) for more information. 53 | -------------------------------------------------------------------------------- /storage/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | --------------------------------------------------------------------------------