Bedrock in a container
Layout of this repository
Check out the branches for each version of Bedrock supported by this repository.
This container includes:
FROM weahead/bedrock:<tag>. Where
version number like
Make sure you add
VOLUME /var/www/htmlto the end of your
Create a folder named
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
Place custom plugins in folder
Use Composer to install non-custom plugins from
WordPress Packagist via
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
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
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,
build. See example package.json
To use additional services, like using node to watch files and compile on save,
S6 supervision can be used. More information on how to use S6 can be found in
The recommended way is to use
COPY root / in a descendant
the directory structure found in example/root.
Notes for usage in production
It is probably a good idea to provide a new configuration file for
/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
FROMs this image, or via another
container that exposes configuration via Docker volumes.
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 ..
# 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