├── .dockerignore ├── .editorconfig ├── .github ├── FUNDING.yml ├── codeowners ├── dependabot.yml ├── security └── workflows │ ├── build.yml │ └── deploy.yml ├── .gitignore ├── .rubocop.yml ├── .ruby-version ├── .travis.yml ├── COPYING ├── Gemfile ├── README.md ├── opts.yml ├── repos ├── builder │ ├── Dockerfile │ ├── copy │ └── opts.yml ├── jekyll │ ├── Dockerfile │ ├── copy │ │ └── all │ │ │ └── usr │ │ │ └── jekyll │ │ │ └── bin │ │ │ ├── bundle │ │ │ ├── connected │ │ │ ├── default-args │ │ │ ├── default-gem-permissions │ │ │ ├── entrypoint │ │ │ ├── gem │ │ │ └── jekyll │ └── opts.yml └── minimal │ ├── Dockerfile │ ├── copy │ └── opts.yml └── script ├── build ├── deploy └── sync /.dockerignore: -------------------------------------------------------------------------------- 1 | # -- 2 | # OS Level 3 | # -- 4 | .DS_Store 5 | 6 | # -- 7 | # Ruby 8 | # -- 9 | vendor/ 10 | coverage/ 11 | Gemfile.lock 12 | spec/fixture/site/ 13 | spec/fixture/result/ 14 | spec/fixture/out/ 15 | .bundle/ 16 | *.gem 17 | 18 | # -- 19 | # CodeClimate 20 | # -- 21 | cctr 22 | 23 | # -- 24 | # Jekyll 25 | # -- 26 | _site/ 27 | .jekyll-cache/ 28 | .jekyll-metadata 29 | .asset-cache/ 30 | site/ 31 | 32 | # -- 33 | # Rails 34 | # -- 35 | /db/*.sqlite3 36 | /npm-error.log 37 | .byebug_history 38 | /db/*.sqlite3-journal 39 | /config/application.yml 40 | /config/master.key 41 | /yarn-error.log 42 | /node_modules 43 | .pry_history 44 | /log 45 | /tmp 46 | 47 | # -- 48 | # Yarn 49 | # -- 50 | yarn.lock 51 | 52 | # 53 | # Editor 54 | # 55 | /.idea 56 | 57 | # 58 | # Git 59 | # 60 | /.git -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | end_of_line = lf 9 | indent_size = 2 10 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: envygeeks 2 | -------------------------------------------------------------------------------- /.github/codeowners: -------------------------------------------------------------------------------- 1 | * @envygeeks 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.github/security: -------------------------------------------------------------------------------- 1 | * @envygeeks 2 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: 'Pull' 2 | on: 3 | - pull_request 4 | jobs: 5 | build: 6 | runs-on: ubuntu-latest 7 | timeout-minutes: 360 8 | name: 'Build' 9 | strategy: 10 | matrix: 11 | env: 12 | - jekyll:latest 13 | - builder:latest 14 | - minimal:latest 15 | - jekyll:pages 16 | steps: 17 | - uses: actions/checkout@v3 18 | - uses: actions/setup-ruby@v1 19 | with: 20 | ruby-version: '2.x' 21 | - run: bundle install 22 | - run: | 23 | echo $'{\n "experimental": true\n}' | \ 24 | sudo tee /etc/docker/daemon.json 25 | sudo systemctl restart docker 26 | name: 'docker experimental' 27 | - run: docker-template build $DOCKER_REPO --no-push --force --squash 28 | env: 29 | RUBYOPT: "-W0" 30 | DOCKER_REPO: "${{join(matrix.env, ' ')}}" 31 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: 'Push' 2 | on: 3 | push: 4 | branches: 5 | - $default-branch 6 | schedule: 7 | - cron: 2 4 10 * * 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | timeout-minutes: 360 12 | name: 'Build' 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | env: 17 | - 18 | - jekyll:4.2.2 19 | - jekyll:stable 20 | - jekyll:latest 21 | - jekyll:4.0 22 | - jekyll:4 23 | - 24 | - builder:4.2.2 25 | - builder:stable 26 | - builder:latest 27 | - builder:4.0 28 | - builder:4 29 | - 30 | - minimal:4.2.2 31 | - minimal:stable 32 | - minimal:latest 33 | - minimal:4.0 34 | - minimal:4 35 | - builder:pages 36 | - minimal:pages 37 | - jekyll:pages 38 | steps: 39 | - uses: actions/checkout@v3 40 | - uses: actions/setup-ruby@v1 41 | with: 42 | ruby-version: '2.x' 43 | - run: bundle install 44 | - run: | 45 | echo $'{\n "experimental": true\n}' | \ 46 | sudo tee /etc/docker/daemon.json 47 | sudo systemctl restart docker 48 | name: 'docker experimental' 49 | - name: 'docker login' 50 | run: | 51 | echo "${{secrets.DOCKER_PASSWORD}}" | docker login \ 52 | --username ${{secrets.DOCKER_USERNAME}} \ 53 | --password-stdin 54 | - run: | 55 | docker-template build $DOCKER_REPO --no-push --force --squash 56 | docker-template push $DOCKER_REPO 57 | env: 58 | RUBYOPT: "-W0" 59 | DOCKER_REPO: "${{join(matrix.env, ' ')}}" 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # -- 2 | # OS Level 3 | # -- 4 | .DS_Store 5 | 6 | # -- 7 | # Ruby 8 | # -- 9 | vendor/ 10 | coverage/ 11 | Gemfile.lock 12 | spec/fixture/site/ 13 | spec/fixture/result/ 14 | spec/fixture/out/ 15 | .bundle/ 16 | *.gem 17 | 18 | # -- 19 | # CodeClimate 20 | # -- 21 | cctr 22 | 23 | # -- 24 | # Jekyll 25 | # -- 26 | _site/ 27 | .jekyll-cache/ 28 | .jekyll-metadata 29 | .asset-cache/ 30 | site/ 31 | 32 | # -- 33 | # Rails 34 | # -- 35 | /db/*.sqlite3 36 | /npm-error.log 37 | .byebug_history 38 | /db/*.sqlite3-journal 39 | /config/application.yml 40 | /config/master.key 41 | /yarn-error.log 42 | /node_modules 43 | .pry_history 44 | /log 45 | /tmp 46 | 47 | # -- 48 | # Yarn 49 | # -- 50 | yarn.lock 51 | 52 | # 53 | # Editor 54 | # 55 | /.idea 56 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_gem: 2 | envygeeks-rubocop: 3 | - rules.yml 4 | Style/SingleLineMethods: { Enabled: false } 5 | Layout/EmptyLineBetweenDefs: { Enabled: false } 6 | Style/StringLiterals: 7 | EnforcedStyle: double_quotes 8 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.0 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: docker 3 | script: script/travis 4 | sudo: required 5 | language: ruby 6 | os: linux 7 | cache: 8 | bundler: true 9 | directories: 10 | - vendor/bundle 11 | branches: 12 | only: 13 | - master 14 | env: 15 | global: 16 | - DOCKER_EMAIL=jordon@envygeeks.io 17 | - DOCKER_USERNAME=envygeeks 18 | - secure: "\ 19 | Vp8S6Pevc4pidnNM1NZx/1rCckOFc5C90a/0c6F/fIhGiOfl3o3yaUBKqbBLNTYxYCH8J0Hko\ 20 | S/Y5Xs2K5XMlsnQXXxeBQntDVMS6XX5q7j65EcK+bRNUxOo2A51rw0jUmPDNa2i7g90sNExjW\ 21 | XYh03nFe6cbXXHrLdrOt4+A4I= 22 | " 23 | jobs: 24 | include: 25 | - script: true 26 | stage: precache 27 | - stage: build 28 | # -- 29 | # jekyll/jekyll 30 | # -- 31 | env: "\ 32 | DOCKER_REPO='\ 33 | jekyll:4.2.2 \ 34 | jekyll:stable \ 35 | jekyll:latest \ 36 | jekyll:pages \ 37 | jekyll:4.0 \ 38 | jekyll:4 \ 39 | '\ 40 | " 41 | # -- 42 | # jekyll/builder 43 | # -- 44 | - env: "\ 45 | DOCKER_REPO='\ 46 | builder:4.2.2 \ 47 | builder:stable \ 48 | builder:latest \ 49 | jekyll:builder \ 50 | builder:pages \ 51 | builder:4.0 \ 52 | builder:4 \ 53 | '\ 54 | " 55 | # -- 56 | # jekyll/minimal 57 | # -- 58 | - env: "\ 59 | DOCKER_REPO='\ 60 | minimal:4.2.2 \ 61 | minimal:stable \ 62 | minimal:latest \ 63 | jekyll:minimal \ 64 | minimal:pages \ 65 | minimal:4.0 \ 66 | minimal:4 \ 67 | '\ 68 | " 69 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-2020 Jordon Bedwell 2 | 3 | Permission to use, copy, modify, and/or distribute this software for 4 | any purpose with or without fee is hereby granted, provided that the 5 | above copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 12 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 13 | OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "docker-template" 4 | 5 | group :development do 6 | gem 'envygeeks-rubocop' 7 | unless ENV["CI"] == "true" 8 | gem "travis" 9 | gem "pry" 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Github Workflow Status](https://img.shields.io/github/workflow/status/envygeeks/jekyll-docker/Push?style=for-the-badge)](https://github.com/envygeeks/jekyll-docker/actions) [![Donate](https://img.shields.io/badge/DONATE-MONEY-yellow.svg?style=for-the-badge)](https://envygeeks.io#donate) [![Docker Stars](https://img.shields.io/docker/stars/jekyll/jekyll.svg?style=for-the-badge)]() [![Docker Pulls](https://img.shields.io/docker/pulls/jekyll/jekyll.svg?style=for-the-badge)]() 2 | 3 | # Jekyll Docker 4 | 5 | Jekyll Docker is a software image that has Jekyll and many of its dependencies ready to use for you in an encapsulated format. It includes a default set of gems, different image types with different extra packages, and wrappers to make Jekyll run more smoothly from start to finish for most Jekyll users. If you would like to know more about Docker you can visit https://docker.com, and if you would like to know more about Jekyll, you can visit https://github.com/jekyll/jekyll 6 | 7 | ## Image Types 8 | 9 | * `jekyll/jekyll`: Default image. 10 | * `jekyll/minimal`: Very minimal image. 11 | * `jekyll/builder`: Includes tools. 12 | 13 | ### Standard 14 | 15 | The standard images (`jekyll/jekyll`) include a default set of "dev" packages, along with Node.js, and other stuff that makes Jekyll easy. It also includes a bunch of default gems that the community wishes us to maintain on the image. 16 | 17 | #### Usage 18 | 19 | ```sh 20 | export JEKYLL_VERSION=3.8 21 | docker run --rm \ 22 | --volume="$PWD:/srv/jekyll:Z" \ 23 | -it jekyll/jekyll:$JEKYLL_VERSION \ 24 | jekyll build 25 | ``` 26 | #### Quick start under Windows (cmd) 27 | ```cmd 28 | set site_name=my-blog 29 | docker run --rm --volume="%CD%:/srv/jekyll" -it jekyll/jekyll sh -c "chown -R jekyll /usr/gem/ && jekyll new %site_name%" && cd %site_name% 30 | ``` 31 | #### Quick start under Linux / Git Bash 32 | If you are under linux skip `export MSYS_NO_PATHCONV=1`. It is added for compatibility. You can check [here](https://github.com/docker-archive/toolbox/issues/673). 33 | ```sh 34 | export site_name="my-blog" && export MSYS_NO_PATHCONV=1 35 | docker run --rm \ 36 | --volume="$PWD:/srv/jekyll" \ 37 | -it jekyll/jekyll \ 38 | sh -c "chown -R jekyll /usr/gem/ && jekyll new $site_name" \ 39 | && cd $site_name 40 | ``` 41 | ### Builder 42 | 43 | The builder image comes with extra stuff that is not included in the standard image, like `lftp`, `openssh` and other extra packages meant to be used by people who are deploying their Jekyll builds to another server with a CI. 44 | 45 | #### Usage 46 | 47 | ```sh 48 | export JEKYLL_VERSION=3.8 49 | docker run --rm \ 50 | --volume="$PWD:/srv/jekyll:Z" \ 51 | -it jekyll/builder:$JEKYLL_VERSION \ 52 | jekyll build 53 | ``` 54 | 55 | ### Minimal 56 | 57 | The minimal image skips all the extra gems, all the extra dev dependencies and leaves a very small image to download. This is intended for people who do not need anything extra but Jekyll. 58 | 59 | #### Usage 60 | 61 | ***You will need to provide a `.apk` file if you intend to use anything like Nokogiri or otherwise, we do not install any development headers or dependencies so C based gems will fail to install.*** 62 | 63 | ```sh 64 | export JEKYLL_VERSION=3.8 65 | docker run --rm \ 66 | --volume="$PWD:/srv/jekyll:Z" \ 67 | -it jekyll/minimal:$JEKYLL_VERSION \ 68 | jekyll build 69 | ``` 70 | 71 | #### Rootless Containers 72 | 73 | If you are using a rootless container management system, you can set the `JEKYLL_ROOTLESS` environment variable to any non-zero value. For example, you can use the following to initialize a new jekyll project in the current directory using [`podman`](https://podman.io/). 74 | 75 | ```sh 76 | podman run -ti --rm -v .:/srv/jekyll -e JEKYLL_ROOTLESS=1 docker.io/jekyll/jekyll jekyll new . 77 | ``` 78 | 79 | ## Server 80 | 81 | For local development, Jekyll can be run in server mode inside the container. It will watch for changes, rebuild the site, and provide access through its included web server. You can then check the results of changes by reloading http://localhost:4000/ in a browser. 82 | 83 | #### Usage 84 | 85 | ```sh 86 | docker run --rm \ 87 | --volume="$PWD:/srv/jekyll:Z" \ 88 | --publish [::1]:4000:4000 \ 89 | jekyll/jekyll \ 90 | jekyll serve 91 | ``` 92 | ## Dependencies 93 | 94 | Jekyll Docker will attempt to install any dependencies that you list inside of your `Gemfile`, matching the versions you have in your `Gemfile.lock`, including Jekyll if you have a version that does not match the version of the image you are using (you should be doing `gem "jekyll", "~> 3.8"` so that minor versions are installed if you use say image tag "3.7.3"). 95 | 96 | ### Updating 97 | 98 | If you provide a `Gemfile` and would like to update your `Gemfile.lock` you can run 99 | 100 | ```sh 101 | export JEKYLL_VERSION=3.8 102 | docker run --rm \ 103 | --volume="$PWD:/srv/jekyll:Z" \ 104 | -it jekyll/jekyll:$JEKYLL_VERSION \ 105 | bundle update 106 | ``` 107 | 108 | ### Caching 109 | 110 | You can enable caching in Jekyll Docker by using a `docker --volume` that points to `/usr/local/bundle` inside of the image. This is ideal for users who run builds on CI's and wish them to be fast. 111 | 112 | #### My Gems Aren't Caching 113 | 114 | ***If you do not diverge from the default set of gems we provide (read: add Gems to your Gemfile that aren't already on the image), then bundler by default will not create duplicates, and cache. It will simply rely on what is already installed in `$GEM_HOME`. This is the default (observed... but unconfirmed) behavior of `bundle` when using `$GEM_HOME` w/ `$BUNDLE_HOME`*** 115 | 116 | ### Usage 117 | 118 | ```sh 119 | export JEKYLL_VERSION=3.8 120 | docker run --rm \ 121 | --volume="$PWD:/srv/jekyll:Z" \ 122 | --volume="$PWD/vendor/bundle:/usr/local/bundle:Z" \ 123 | -it jekyll/jekyll:$JEKYLL_VERSION \ 124 | jekyll build 125 | ``` 126 | ***The root of the cache volume (in this case vendor) must also be excluded from the Jekyll build via the `_config.yml` exclude array setting.*** 127 | 128 | ## Configuration 129 | 130 | You can configure some pieces of Jekyll using environment variables, what you cannot with environment variables you can configure using the Jekyll CLI. Even with a wrapper, we pass all arguments onto Jekyll when we finally call it. 131 | 132 | | ENV Var | Default | 133 | |---|---| 134 | | `JEKYLL_UID` | `1000` | 135 | | `JEKYLL_GID` | `1000` | 136 | | `JEKYLL_DEBUG`, | `""` | 137 | | `VERBOSE` | `""` | 138 | | `FORCE_POLLING` | `""` | 139 | 140 | If you would like to know the CLI options for Jekyll, you can visit [Jekyll's Help Site][2] 141 | 142 | ## Packages 143 | 144 | You can install system packages by providing a file named `.apk` with one package per line. If you need to find out what the package names are for a given command you wish to use you can visit https://pkgs.alpinelinux.org. ***We provide many dependencies for most Ruby stuff by default for `builder` and standard images. This includes `ruby-dev`, `xml`, `xslt`, `git` and other stuff that most Ruby packages might need.*** 145 | 146 | ## Building 147 | 148 | ```sh 149 | script/build 150 | ``` 151 | 152 | [1]: https://travis-ci.org/jekyll/docker 153 | [2]: http://jekyllrb.com/docs/configuration/#build-command-options 154 | -------------------------------------------------------------------------------- /opts.yml: -------------------------------------------------------------------------------- 1 | base_image: ruby:3.1.1-alpine3.15 2 | user: jekyll 3 | aliases: 4 | latest: 4.2.2 5 | stable: 4.2.2 6 | 4.0: 4.2.2 7 | 4: 4.2.2 8 | tags: 9 | 4.2.2: stable 10 | pages: pages 11 | releases: 12 | tag: 13 | pages: 3.8.5 # 05-15-2020 14 | -------------------------------------------------------------------------------- /repos/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ../jekyll/Dockerfile -------------------------------------------------------------------------------- /repos/builder/copy: -------------------------------------------------------------------------------- 1 | ../jekyll/copy -------------------------------------------------------------------------------- /repos/builder/opts.yml: -------------------------------------------------------------------------------- 1 | packages: 2 | all: 3 | - rsync 4 | - openssh-client 5 | - lftp 6 | - git 7 | env: 8 | all: 9 | JEKYLL_ENV: production 10 | gems: 11 | all: &gems 12 | - s3_website 13 | - html-proofer 14 | - jekyll-sitemap 15 | - jekyll-mentions 16 | - jekyll-coffeescript 17 | - jekyll-sass-converter 18 | - jekyll-redirect-from 19 | - jekyll-paginate 20 | - jekyll-compose 21 | - jekyll-feed 22 | - jekyll-docs 23 | - RedCloth 24 | - kramdown 25 | - jemoji 26 | - minima 27 | group: 28 | pages: 29 | - *gems 30 | - github-pages 31 | - jekyll-github-metadata 32 | -------------------------------------------------------------------------------- /repos/jekyll/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM <%= @meta.base_image %> 2 | LABEL maintainer "Jordon Bedwell " 3 | COPY copy / 4 | 5 | # 6 | # EnvVars 7 | # Ruby 8 | # 9 | 10 | ENV BUNDLE_HOME=/usr/local/bundle 11 | ENV BUNDLE_APP_CONFIG=/usr/local/bundle 12 | ENV BUNDLE_DISABLE_PLATFORM_WARNINGS=true 13 | ENV BUNDLE_BIN=/usr/local/bundle/bin 14 | ENV GEM_BIN=/usr/gem/bin 15 | ENV GEM_HOME=/usr/gem 16 | ENV RUBYOPT=-W0 17 | 18 | # 19 | # EnvVars 20 | # Image 21 | # 22 | 23 | ENV JEKYLL_VAR_DIR=/var/jekyll 24 | ENV JEKYLL_DOCKER_TAG=<%= @meta.tag %> 25 | ENV JEKYLL_VERSION=<%= @meta.release?? @meta.release : @meta.tag %> 26 | ENV JEKYLL_DOCKER_COMMIT=<%= `git rev-parse --verify HEAD`.strip %> 27 | ENV JEKYLL_DOCKER_NAME=<%= @meta.name %> 28 | ENV JEKYLL_DATA_DIR=/srv/jekyll 29 | ENV JEKYLL_BIN=/usr/jekyll/bin 30 | ENV JEKYLL_ENV=development 31 | 32 | # 33 | # EnvVars 34 | # System 35 | # 36 | 37 | ENV LANG=en_US.UTF-8 38 | ENV LANGUAGE=en_US:en 39 | ENV TZ=America/Chicago 40 | ENV PATH="$JEKYLL_BIN:$PATH" 41 | ENV LC_ALL=en_US.UTF-8 42 | ENV LANG=en_US.UTF-8 43 | ENV LANGUAGE=en_US 44 | 45 | # 46 | # EnvVars 47 | # User 48 | # 49 | 50 | <% if @meta.env? %> 51 | ENV <%= @meta.env %> 52 | <% end %> 53 | 54 | # 55 | # EnvVars 56 | # Main 57 | # 58 | 59 | env VERBOSE=false 60 | env FORCE_POLLING=false 61 | env DRAFTS=false 62 | 63 | # 64 | # Packages 65 | # User 66 | # 67 | 68 | <% if @meta.packages? %> 69 | RUN apk --no-cache add <%= @meta.packages %> 70 | <% end %> 71 | 72 | # 73 | # Packages 74 | # Dev 75 | # 76 | 77 | RUN apk --no-cache add \ 78 | zlib-dev \ 79 | libffi-dev \ 80 | build-base \ 81 | libxml2-dev \ 82 | imagemagick-dev \ 83 | readline-dev \ 84 | libxslt-dev \ 85 | libffi-dev \ 86 | yaml-dev \ 87 | zlib-dev \ 88 | vips-dev \ 89 | vips-tools \ 90 | sqlite-dev \ 91 | cmake 92 | 93 | # 94 | # Packages 95 | # Main 96 | # 97 | 98 | RUN apk --no-cache add \ 99 | linux-headers \ 100 | openjdk8-jre \ 101 | less \ 102 | zlib \ 103 | libxml2 \ 104 | readline \ 105 | libxslt \ 106 | libffi \ 107 | git \ 108 | nodejs \ 109 | tzdata \ 110 | shadow \ 111 | bash \ 112 | su-exec \ 113 | npm \ 114 | libressl \ 115 | yarn 116 | 117 | # 118 | # Gems 119 | # Update 120 | # 121 | 122 | RUN echo "gem: --no-ri --no-rdoc" > ~/.gemrc 123 | RUN unset GEM_HOME && unset GEM_BIN && \ 124 | yes | gem update --system 125 | 126 | # 127 | # Gems 128 | # Main 129 | # 130 | 131 | RUN unset GEM_HOME && unset GEM_BIN && yes | gem install --force bundler 132 | RUN gem install jekyll -v<%= @meta.release?? \ 133 | @meta.release : @meta.tag %> -- \ 134 | --use-system-libraries 135 | 136 | # 137 | # Gems 138 | # User 139 | # 140 | 141 | <% if @meta.gems? %> 142 | # Stops slow Nokogiri! 143 | RUN gem install <%=@meta.gems %> -- \ 144 | --use-system-libraries 145 | <% end %> 146 | 147 | RUN addgroup -Sg 1000 jekyll 148 | RUN adduser -Su 1000 -G \ 149 | jekyll jekyll 150 | 151 | # 152 | # Remove development packages on minimal. 153 | # And on pages. Gems are unsupported. 154 | # 155 | 156 | <% if @meta.name == "minimal" || @meta.name == "pages" || @meta.tag == "pages" %> 157 | RUN apk --no-cache del \ 158 | linux-headers \ 159 | openjdk8-jre \ 160 | zlib-dev \ 161 | build-base \ 162 | libxml2-dev \ 163 | libxslt-dev \ 164 | readline-dev \ 165 | imagemagick-dev\ 166 | libffi-dev \ 167 | ruby-dev \ 168 | yaml-dev \ 169 | zlib-dev \ 170 | libffi-dev \ 171 | vips-dev \ 172 | vips-tools \ 173 | cmake 174 | <% end %> 175 | 176 | RUN mkdir -p $JEKYLL_VAR_DIR 177 | RUN mkdir -p $JEKYLL_DATA_DIR 178 | RUN chown -R jekyll:jekyll $JEKYLL_DATA_DIR 179 | RUN chown -R jekyll:jekyll $JEKYLL_VAR_DIR 180 | RUN chown -R jekyll:jekyll $BUNDLE_HOME 181 | RUN rm -rf /home/jekyll/.gem 182 | RUN rm -rf $BUNDLE_HOME/cache 183 | RUN rm -rf $GEM_HOME/cache 184 | RUN rm -rf /root/.gem 185 | 186 | # Work around rubygems/rubygems#3572 187 | RUN mkdir -p /usr/gem/cache/bundle 188 | RUN chown -R jekyll:jekyll \ 189 | /usr/gem/cache/bundle 190 | 191 | CMD ["jekyll", "--help"] 192 | ENTRYPOINT ["/usr/jekyll/bin/entrypoint"] 193 | WORKDIR /srv/jekyll 194 | VOLUME /srv/jekyll 195 | EXPOSE 35729 196 | EXPOSE 4000 197 | -------------------------------------------------------------------------------- /repos/jekyll/copy/all/usr/jekyll/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ "$DEBUG" = "true" ] && set -x 3 | exe=/usr/local/bin/bundle 4 | default-gem-permissions 5 | set -e 6 | 7 | # 8 | # Skip out if we aren't UID=0 because it's Jekyll 9 | # Don't prevent the user from doing normal bundle stuff 10 | # this is really rare but can happen during debugs 11 | # 12 | if [[ ! -f "Gemfile" ]] || [ "$(id -u)" != "0" ]; then 13 | exec $exe "$@" 14 | fi 15 | 16 | if [ "$1" = "install" ] || [ "$1" = "update" ]; then 17 | # There is no need to report that we are using check. 18 | if [ "$1" = "update" ] || ! su-exec jekyll $exe check 1>/dev/null 2>&1; then 19 | if [ ! -f "/updated" ] && connected && [ -f ".apk" ]; then 20 | apk add --no-cache --no-progress \ 21 | $(cat .apk) 22 | fi 23 | 24 | su-exec jekyll $exe config jobs 2 25 | su-exec jekyll $exe config ignore_messages true 26 | su-exec jekyll $exe config build.nokogiri --use-system-libraries 27 | su-exec jekyll $exe config disable_version_check true 28 | unset DEBUG; su-exec jekyll $exe "$@" 29 | su-exec jekyll $exe clean \ 30 | 2>/dev/null || true 31 | fi 32 | else 33 | su-exec jekyll $exe "$@" 34 | fi 35 | -------------------------------------------------------------------------------- /repos/jekyll/copy/all/usr/jekyll/bin/connected: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ "$DEBUG" = "true" ] && set -x 3 | set -e 4 | 5 | connected=$JEKYLL_VAR_DIR/connected 6 | disconnected=$JEKYLL_VAR_DIR/disconnected 7 | [ -f "$disconnected" ] && [ -f "$connected" ] && rm -f "$disconnected" "$connected" 8 | { [ "$CONNECTED" = "false" ] || [ -f "$disconnected" ]; } && exit 1 9 | { [ "$CONNECTED" = "true" ] || [ -f "$connected" ]; } && exit 0 10 | 11 | # 12 | # If we aren't connected, or forced as connected, or not 13 | # connected then we should check with WGet (because of Proxies) 14 | # whether we are connected to the internet. 15 | # 16 | 17 | url=https://detectportal.firefox.com 18 | if wget -q --spider "$url" -O /dev/null 2>/dev/null; then 19 | su-exec jekyll touch "$connected" 20 | exit 0 21 | else 22 | su-exec jekyll touch $disconnected 23 | exit 1 24 | fi 25 | -------------------------------------------------------------------------------- /repos/jekyll/copy/all/usr/jekyll/bin/default-args: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "shellwords" 3 | 4 | def to_bool(val) 5 | %w(true 1).include?(val) \ 6 | ? "true" : nil 7 | end 8 | 9 | %w(VERBOSE DRAFTS FORCE_POLLING).each do |v| 10 | ENV[v] = to_bool( 11 | ENV[v] 12 | ) 13 | end 14 | 15 | def build?; %w(b build).include?(ARGV[0]); end 16 | def serve?; %w(s serve server).include?(ARGV[0]); end 17 | def safe?; ENV["JEKYLL_DOCKER_TAG"] == "pages" || ENV["JEKYLL_DOCKER_NAME"] == "minimal"; end 18 | def debug?; ENV["VERBOSE"]; end 19 | 20 | ARGV.shift and ARGV.unshift("serve") if "s" == ARGV[0] 21 | ARGV.push("--force_polling") if ENV["FORCE_POLLING"] && (build? || serve?) 22 | ARGV.unshift(ARGV.shift, "-H", "0.0.0.0") if serve? 23 | ARGV.push("--drafts") if ENV["DRAFTS"] 24 | ARGV.push("--verbose") if debug? 25 | 26 | $stdout.puts Shellwords.shelljoin( 27 | ARGV 28 | ) 29 | -------------------------------------------------------------------------------- /repos/jekyll/copy/all/usr/jekyll/bin/default-gem-permissions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ "$DEBUG" = "true" ] && set -x 3 | set -e 4 | 5 | if [ "$(id -u)" = "0" ]; then 6 | chown -R jekyll:jekyll "$BUNDLE_HOME" 7 | chown -R jekyll:jekyll /usr/gem 8 | fi 9 | -------------------------------------------------------------------------------- /repos/jekyll/copy/all/usr/jekyll/bin/entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ "$DEBUG" = "true" ] && set -x 3 | set -e 4 | 5 | # 6 | # Running rootless means that we force Jekyll to run 7 | # entirely as 'root'. This is substituted by the container 8 | # to the uid of the actual user. 9 | # 10 | if [ "$JEKYLL_ROOTLESS" ]; then 11 | JEKYLL_UID=0 12 | JEKYLL_GID=0 13 | fi 14 | 15 | : ${JEKYLL_UID:=$(id -u jekyll)} 16 | : ${JEKYLL_GID:=$(id -g jekyll)} 17 | export JEKYLL_UID 18 | export JEKYLL_GID 19 | 20 | # 21 | # Users can customize our UID's to fit their own so that 22 | # we don't have to chown constantly. Well it's not like 23 | # we do so much of it (anymore) it's slow, but we do 24 | # change permissions which can result in some bad 25 | # behavior on OS X. 26 | # 27 | if [ "$JEKYLL_UID" != "0" ] && [ "$JEKYLL_UID" != "$(id -u jekyll)" ]; then 28 | usermod -o -u "$JEKYLL_UID" jekyll 29 | groupmod -o -g "$JEKYLL_GID" jekyll 30 | chown_args="" 31 | 32 | [ "$FULL_CHOWN" ] && chown_args="-R" 33 | for d in "$JEKYLL_DATA_DIR" "$JEKYLL_VAR_DIR"; do 34 | chown $chown_args jekyll:jekyll "$d" 35 | done 36 | fi 37 | 38 | # 39 | # Make sure JEKYLL matches the UID/GID 40 | # This will most likely end up as 1 41 | # 42 | if [ "$JEKYLL_ROOTLESS" ]; then 43 | usermod -o -u $JEKYLL_UID jekyll 44 | groupmod -o -g $JEKYLL_GID jekyll 45 | fi 46 | 47 | exec "$@" 48 | -------------------------------------------------------------------------------- /repos/jekyll/copy/all/usr/jekyll/bin/gem: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ "$DEBUG" = "true" ] && set -x 3 | default-gem-permissions 4 | exe=/usr/local/bin/gem 5 | set -e 6 | 7 | exec $exe "$@" 8 | -------------------------------------------------------------------------------- /repos/jekyll/copy/all/usr/jekyll/bin/jekyll: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ "$DEBUG" = "true" ] && set -x 3 | set -e 4 | 5 | trap 'kill -SIGTERM ${!}' TERM 6 | 7 | args=$(default-args "$@") 8 | 9 | # 10 | # The assumption here is that if we aren't ID 0 then 11 | # something we wrapped, recalled us, so we need to ship 12 | # them to the right spot. This can happen in one 13 | # scenario (when you do `jekyll new`.) 14 | # 15 | if [ "$(id -u)" != "0" ]; then 16 | exec "$BUNDLE_BIN/jekyll" "$@" 17 | fi 18 | 19 | [ -d ".cache" ] && chown -R jekyll:jekyll .cache 20 | [ -d ".jekyll-cache" ] && chown -R jekyll:jekyll .jekyll-cache 21 | [ -d ".sass-cache" ] && chown -R jekyll:jekyll .sass-cache 22 | [ -d "_site" ] && chown -R jekyll:jekyll _site 23 | 24 | # 25 | # Install if the user has a Gemfile. 26 | # Install if we are also connecteds. 27 | # 28 | if [ -f "Gemfile" ] && connected; then 29 | bundle install 30 | fi 31 | 32 | ruby --version 33 | 34 | sup_args="" 35 | exe=$BUNDLE_BIN/jekyll 36 | [ "$JEKYLL_DOCKER_TAG" = "pages" ] && sup_args="-r github-pages" 37 | [ -x "$exe" ] && exec su-exec jekyll bundle exec ruby $sup_args $exe $args 38 | su-exec jekyll ruby $sup_args "$GEM_BIN/jekyll" $args & wait ${!} 39 | -------------------------------------------------------------------------------- /repos/jekyll/opts.yml: -------------------------------------------------------------------------------- 1 | aliases: 2 | builder: jekyll/builder:latest 3 | minimal: jekyll/minimal:latest 4 | gems: 5 | all: 6 | - html-proofer 7 | - jekyll-reload 8 | - jekyll-mentions 9 | - jekyll-coffeescript 10 | - jekyll-sass-converter 11 | - jekyll-commonmark 12 | - jekyll-paginate 13 | - jekyll-compose 14 | - jekyll-assets 15 | - RedCloth 16 | - kramdown 17 | - jemoji 18 | group: 19 | relative: &relative 20 | - jekyll-redirect-from 21 | - jekyll-sitemap 22 | - jekyll-feed 23 | - minima 24 | stable: 25 | - *relative 26 | pages: 27 | - jekyll-github-metadata 28 | - github-pages 29 | -------------------------------------------------------------------------------- /repos/minimal/Dockerfile: -------------------------------------------------------------------------------- 1 | ../jekyll/Dockerfile -------------------------------------------------------------------------------- /repos/minimal/copy: -------------------------------------------------------------------------------- 1 | ../jekyll/copy -------------------------------------------------------------------------------- /repos/minimal/opts.yml: -------------------------------------------------------------------------------- 1 | gems: 2 | all: &gems 3 | - kramdown 4 | - jekyll-sass-converter 5 | - jekyll-coffeescript 6 | - minima 7 | group: 8 | pages: 9 | - *gems 10 | - github-pages 11 | - jekyll-github-metadata 12 | -------------------------------------------------------------------------------- /script/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash -l 2 | # Copyright: 2017 - 2018 - MIT License 3 | # Source: https://github.com/envygeeks/devfiles 4 | # Author: Jordon Bedwell 5 | script/install 6 | 7 | [[ "$1" ]] && export DOCKER_REPO="$1" 8 | echo "$DOCKER_REPO" 9 | exit 0 10 | bundle exec docker-template build "$DOCKER_REPO" --no-push --force --squash || \ 11 | exit $? 12 | -------------------------------------------------------------------------------- /script/deploy: -------------------------------------------------------------------------------- 1 | #!/bin/bash -l 2 | # Copyright: 2017 - 2018 - MIT License 3 | # Source: https://github.com/envygeeks/devfiles 4 | # Author: Jordon Bedwell 5 | set -e 6 | 7 | if [ "$TRAVIS_PULL_REQUEST" = "false" ] 8 | then bundle exec docker-template push $DOCKER_REPO 9 | fi 10 | -------------------------------------------------------------------------------- /script/sync: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright: 2017 - 2018 - MIT License 3 | # Source: https://github.com/envygeeks/devfiles 4 | # Author: Jordon Bedwell 5 | # -- 6 | 7 | [ "$DEBUG" = "true" ] && set -x 8 | set -e 9 | 10 | # -- 11 | trim() { 12 | echo "$@" | tr -s " " | \ 13 | sed -e 's/^[[:space:]]*//g' | \ 14 | sed -e 's/[[:space:]]$//g' 15 | } 16 | 17 | # -- 18 | [ -n "$1" ] && git config envygeeks.language "$1" 19 | [ -n "$2" ] && git config envygeeks.external "$2" 20 | 21 | # -- 22 | # Determine what we are working with. 23 | # -- 24 | 25 | skip_if_exists=(Gemfile .travis.yml) 26 | sync_language=$(git config envygeeks.language || echo "") 27 | skip_if_external=(CONTRIBUTING.md CODE_OF_CONDUCT.md .github/codeowners) 28 | skip_if_external+=(.github/issue_template.md .github/pull_request_template.md) 29 | external=$(git config envygeeks.external || echo "false") 30 | github_url=https://github.com/envygeeks/devfiles.git 31 | copy_to=$PWD 32 | 33 | # -- 34 | # Copies everything, except for what's to be skipped if 35 | # it happens to exist, into the current directory, so that 36 | # stays in sync with the parent. 37 | # -- 38 | 39 | clone_dir=$(mktemp -d) 40 | git clone $github_url "$clone_dir" 41 | for d in $(trim global $sync_language); do 42 | cd "$clone_dir" 43 | 44 | [ ! -d "$d" ] && continue 45 | find "$d" -not -path "$d" -type f | while read f; do 46 | to=$(echo "$f" | sed -e "s/$d\///"); dir=$(dirname "$to") 47 | if [ "$dir" != "$d" ] && [ "$dir" != "." ]; then 48 | if [ ! -d "$copy_to/$dir" ]; then 49 | bash -xc "mkdir -p '$copy_to/$dir'" 50 | fi 51 | fi 52 | 53 | skip=false 54 | for sf in "${skip_if_exists[@]}"; do 55 | if [ "$to" = "$sf" ] && [ -f "$copy_to/$sf" ]; then 56 | skip=true 57 | fi 58 | done 59 | 60 | if [ "$skip" = "false" ] && [ "$external" = "true" ]; then 61 | for sf in "${skip_if_external[@]}"; do 62 | if [ "$to" = "$sf" ] && [ -f "$copy_to/$sf" ]; then 63 | skip=true 64 | fi 65 | done 66 | fi 67 | 68 | if [ "$skip" != "true" ]; then 69 | bash -xc "cp -L '$f' '$copy_to/$to'" 70 | fi 71 | done 72 | done 73 | 74 | rm -rf $clone_dir 75 | --------------------------------------------------------------------------------