This repo contains the source code (i.e. Dockerfile and related scripts) required to build a Docker image that is pegged to the dependency versions used by GitHub Pages. It is based on the official Jekyll Docker image. The resulting Docker image is hosted on Hack for LA’s Docker Hub repo.
This Docker image is specifically designed to run a local Jekyll server for developing and testing the Hack for LA organization’s website. It is not intended for deployment. However, the image can be used by anyone who requires a local development environment that mirrors GitHub Pages.
More detailed technical information can be find on this repo's wiki.
This repo uses a GitHub Action to build and push the Docker image to the hackforlaops/ghpages repo on Docker Hub. The newly-built image will replace the previous version, and appear with the tag latest
. The build-and-push action can be triggered in one of two ways:
- Automatically, whenever a new commit is pushed that changes the Dockerfile, .dockerignore file, .gitignore file, or anything in the
/copy
directory. (Commits to any other files will not trigger a new build.) This means that a new image will be built automatically any time the Dockerfile is updated to match a new version of Ruby or Jekyll being used by GitHub Pages. - Manually, by navigating to the Actions tab in the menu bar at the top of the repo, clicking on the Publish Docker Image workflow in the list of workflows on the left, and then clicking the Run Workflow button on the right. This will build and push a new image whether any changes have been made or not.
Hack for LA's website is run locally using docker compose
. To use this image in the same way for your own Jekyll-based projects, do the following:
- Create or modify a
docker-compose.yml
file in the root of your website directory with the following lines. (Note that you should replace<your-name>
with whatever you would like your Docker container to be called.)
version: "3"
services:
<your-name>:
image: hackforlaops/ghpages:latest
container_name: <your-name>
command: jekyll serve --force_polling --livereload --config _config.yml,_config.docker.yml -I
environment:
- JEKYLL_ENV=docker
ports:
- 4000:4000
- 35729:35729
volumes:
- .:/srv/jekyll
- Create a new file in the root of your website called
_config.docker.yml
with a single line:
url: "http://localhost:4000"
- Run
docker compose up
.
This code is made available under the GNU General Public License v2.0
this readme file sourced from Jessica Sand