Code Monkey home page Code Monkey logo

federalist-docker-build's Introduction

NOTE: The master branch for this repo is the default branch so Docker Hub will build this image correctly for our legacy environment. Our legacy environment is being spun down. People should not use master and should instead prefer the staging branch which has the latest changes and security patches.

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 /path => /path/.

Any errors or final status codes are POSTed to a URL.

Configure the build process with following environment variables:

  • AWS_ACCESS_KEY_ID AWS access key
  • AWS_DEFAULT_REGION AWS region
  • AWS_SECRET_ACCESS_KEY AWS secret key
  • CALLBACK a URL that will receive a POST request with a JSON body including the status code and output message from the Jekyll process
  • BUCKET S3 bucket to upload the built site
  • BASEURL baseurl value to build the site with, including a leading slash
  • CACHE_CONTROL Value to set for the Cache-Control header
  • BRANCH Branch to check out
  • CONFIG A yaml block of configuration to add to _config.yml before building
  • REPOSITORY Name of the re
  • OWNER Owner (GitHub user) of the repository
  • PREFIX Prefix for assets on S3
  • GITHUB_TOKEN GitHub oauth token for cloning the repository
  • GENERATOR The static generator to use to build the site (jekyll or hugo*; anything else will just publish all files in the repository)

* 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.

  1. git clone [email protected]:18F/federalist-docker-build.git && cd federalist-docker-build
  2. docker build -t federalist-docker-build .
  3. docker run federalist-docker-build

After you make any changes to the container, you should run the docker build command again before docker run.

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 18fgsa/federalist-docker-build).

Public domain

This project is in the worldwide public domain. As stated in CONTRIBUTING:

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.