Docker Builder for federalist
This is a Docker image that runs Jekyll to build a and uploads it to AWS S3. It's used to allow Jekyll sites to build with user-provided plugins in a safe space.
First, the container checks out the site from GitHub. Then it builds the site with Jekyll. Then it gzip compresses text files and sets cache control headers. Finally, it uploads the built site to S3 also creates redirect objects for directories, such as
Any errors or final status codes are
POSTed to a URL.
Configure the build process with following environment variables:
AWS_ACCESS_KEY_IDAWS access key
AWS_SECRET_ACCESS_KEYAWS secret key
CALLBACKa URL that will receive a
POSTrequest with a JSON body including the
statuscode and output
messagefrom the Jekyll process
BUCKETS3 bucket to upload the built site
baseurlvalue to build the site with, including a leading slash
CACHE_CONTROLValue to set for the Cache-Control header
BRANCHBranch to check out
CONFIGA yaml block of configuration to add to
REPOSITORYName of the re
OWNEROwner (GitHub user) of the repository
SITE_PREFIXPrefix for assets on S3
GITHUB_TOKENGitHub oauth token for cloning the repository
GENERATORThe static generator to use to build the site (
hugo*; anything else will just publish all files in the repository)
FEDERALIST_BUILDER_CALLBACKThe callback URL the container should use to let federalist-builder know that it has finished.
* The Hugo application is not yet part of this image
The AWS and GitHub token variables are unset in the Jekyll subprocess so Jekyll and its plugins do not have access to this information.
Development & making changes
You'll need to have
docker on your machine installed. If you just want to install the container image and run it, you can use
docker pull 18fgsa/federalist-docker-build.
docker pull behaves similarly to
git pull. Run the container with
docker run 18fgsa/federalist-docker-build.
If you want to make changes, you should first clone the repo and then build the docker container locally.
git clone firstname.lastname@example.org:18F/federalist-docker-build.git && cd federalist-docker-build
docker build -t federalist-docker-build .
docker run federalist-docker-build
After you make any changes to the container, you should run the
docker build command again before
In either case you'll want to supply your docker container with environment variables.
docker run accepts an
-e flag to designate environment variables. You must precede each key/value pair with the flag. For example:
docker run -e OWNER=18f -e REPOSITORY=18f.gsa.gov federalist-docker-build (if you used
docker pull this container image is probably named
Deploying to cloud.gov
For detailed instructions on deploying this build container to cloud.gov, see https://federalist-docs.18f.gov/pages/how-federalist-works/cloud-gov-setup/.
This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.
All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.