Check out the branches for each version of Bedrock supported by this repository.
This container includes:
See example
-
Create a
Dockerfile
withFROM weahead/bedrock:<tag>
. Wheretag
is a version number like1.6.3
. -
Make sure you add
VOLUME /var/www/html
to the end of yourDockerfile
. -
Create a folder named
app
next toDockerfile
. -
Optionally, declare environment variables in docker-compose.yml files.
Detailed info on environment variables and their values can be found in Bedrock documentation.
-
Place custom themes in folder
app/themes
. -
Place custom plugins in folder
app/plugins
. -
Use Composer to install non-custom plugins from WordPress Packagist via
app/composer.json
.This gives you a folder structure like this:
. ├── Dockerfile ├── app │ ├── plugins │ │ ├── custom-plugin-1 │ │ ├── custom-plugin-2 │ │ └── ... │ └── themes │ │ ├── custom-theme-1 │ │ └── ... │ └── composer.json └── ...
-
Build it with
docker build -t <name>:<tag> .
This image has optional support for running a single Node.js service. If there
is a package.json
inside a theme folder, the image will run npm install
in
that folder during the build of a derivative image. Upon startup of a container
from the built derivative image S6 will start a Node.js service that will run a
command depending on the value of the environment variable NODE_ENV
:
Value | Command |
---|---|
development | npm run dev |
production | npm run start |
This is useful for using Node.js based build systems like broccoli, grunt, gulp, etc. when developing the theme.
Also, when building a derivative image npm run build
is executed as part of
the image building to generate resources needed in production. So the
package.json
requires at least 3 scripts, start
, dev
, build
. See example package.json
To use additional services S6 supervision can be used. More information on how to use S6 can be found in their documentation.
The recommended way is to use COPY root /
in a descendant Dockerfile
with
the directory structure found in example/root.
It is probably a good idea to provide a new configuration file for opcache
at
/usr/local/etc/php/conf.d/opcache.ini
. The configuration file included in
this image is for development settings. A new configuration file can be provided
by adding it in the Dockerfile
that FROM
s this image, or via another
container that exposes configuration via Docker volumes.
Dockerfile example:
FROM weahead/bedrock:<tag>
COPY opcache.ini /usr/local/etc/php/conf.d/opcache.ini
Configuration container example with Docker compose:
bedrock:
image: weahead/bedrock:<tag>
volumes_from:
- bedrock-conf
...
bedrock-conf:
build: ./bedrock-conf
..
./bedrock-conf/Dockerfile
:
# Reference same image that weahead/bedrock:<tag> uses as FROM
FROM php:5.6.21-fpm-alpine
COPY opcache.ini /usr/local/etc/php/conf.d/opcache.ini
VOLUME /usr/local/etc/php/conf.d