This repository comprises two docker build contexts for producing a final docker image for running containers that host BU wordpress websites. Such containers can:
This build is based on the standard docker image for WordPress, version 5.4.2 with php version 7.4 and apache:
Create a .env
file at the root of the project. Insert values image build args.
Example file content (Modify the values as directed in later sections):
# ----------------------------------------
# Build Args:
# ----------------------------------------
DOCKER_REGISTRY=770203350335.dkr.ecr.us-east-1.amazonaws.com
GIT_USER=BUWebTeam
GIT_PAT=[value]
MANIFEST_INI_FILE=wp-manifests/devl/jaydub-bulb.ini
REPOS='akismet, responsive-framework-2-x, bu-cms, bu-sustainability, query-monitor'
Build the baseline image
docker compose -f compose-baseline.yml build --no-cache wordpress
You may want to edit the name assigned to the image in docker-compose.yml
to indicate a different registry.
Cleanup if working on the image and doing multiple builds:
docker rmi $(docker images --filter dangling=true -q) 2> /dev/null
Build the "build" image:
The wordpress installation is built as part of the docker image build. Before building, modify the following .env
file entries:
DOCKER_REGISTRY: Will be used to form part of image names, IE: "770203350335.dkr.ecr.us-east-1.amazonaws.com"
GIT_USER: A git user that is part of the bu-ist organization and who has access to the git manifests repository and all git repositories specified in the ini configuration files stored there.
GIT_PAT: It is assumed that the git user will authenticate with a personal access token (PAT). Put this into the .env
file at the root of the project.
(SEE: Running locally for more on what goes into the .env
file).
MANIFEST_INI_FILE: This is currently a single manifest build, so you must select one environment/website combination to build from. So, for example, if your website is "jaydub-bulb" and the environment is "devl", then you would set this value to:
wp-manifests/devl/jaydub-bulb.ini
which is located here
REPOS: This is a comma-delimited list of git repositories from the .ini file that are to be built into the wordpress installation of the image. Each repo must be locatable in the manifest ini file. To build ALL repositories in the manifest, simply omit this entry from the .env
file. Example:
responsive-framework-2-x, bu-cms, bu-sustainability, query-monitor
TODO: Say something about multisite?
Next, build the image itself (be in the root directory of the repo):
export DOCKER_BUILDKIT=0
docker compose build --no-cache wordpress
Publish the image: Put the built image into the BU public registry so it is available to ECS stacks.
# Retag if necessary
docker tag \
770203350335.dkr.ecr.us-east-1.amazonaws.com/bu-wordpress-build \
770203350335.dkr.ecr.us-east-1.amazonaws.com/cms-devl:jaydub-bulb
# Login to the registry
aws ecr get-login-password --region us-east-1 | \
docker login --username AWS --password-stdin 770203350335.dkr.ecr.us-east-1.amazonaws.com
# Push the image
docker push 770203350335.dkr.ecr.us-east-1.amazonaws.com/cms-devl:jaydub-bulb
[Optional] Run the WordPress installation locally: To run the service locally with docker compose, follow these steps