Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile (with some convenience Makerules) for development, testing and serving #461

Merged
merged 32 commits into from
Mar 16, 2018
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
21b1871
Create Dockerfile
johndmulhausen Mar 9, 2017
c192457
Merge branch 'master' into dockerize
vidbina Aug 5, 2017
4ac341c
update ruby in container
vidbina Aug 5, 2017
76e40e0
follow recommendations for apt usage in image
vidbina Aug 5, 2017
ab2a31f
use /src as workdir
vidbina Aug 5, 2017
4f97a96
mount gh-pages + setup local override
vidbina Aug 6, 2017
1ffa175
serve site by default
vidbina Aug 6, 2017
4735c43
Makefile to keep it simple
vidbina Aug 6, 2017
46e410d
Merge branch 'master' into dockerize
vidbina Aug 30, 2017
5733af2
default to /site as workdir after bundle install
vidbina Sep 2, 2017
2bb738f
sourceable func for bash and zsh
vidbina Sep 2, 2017
209aa53
1st attempt at documenting the docker approach
vidbina Sep 2, 2017
a7a7e73
Merge branch 'master' into dockerize
vidbina Sep 2, 2017
1381be0
Merge documentation and shell func
vidbina Sep 2, 2017
0a6fc82
tried to be clearer... hopefully it worked
vidbina Sep 2, 2017
6cfbab0
which function?!?
vidbina Sep 2, 2017
a31946e
how-to enable func.sh + moved some bits to asides
vidbina Sep 2, 2017
3b30541
forgot to close
vidbina Sep 2, 2017
21101e2
Merge remote-tracking branch 'upstream/master'
vidbina Nov 25, 2017
cbe4cdf
docker image: moved /gh-pages to /src/gh/pages-gem
vidbina Nov 26, 2017
03709aa
docker image: echo err on undef or invalid $SITE
vidbina Nov 26, 2017
9d8fe18
docker image: moved /site to /src/site
vidbina Nov 26, 2017
f4a8d87
docker image: moved func.sh to contrib/func.sh
vidbina Nov 26, 2017
bc487a3
Merge branch 'master' into dockerize
vidbina Nov 27, 2017
8b6a3d2
Merge branch 'upstream/master' into dockerize
vidbina Nov 27, 2017
9d3ffff
docker helper: better shebang
vidbina Nov 27, 2017
be1ac57
docker helper: set uid and gid
vidbina Nov 27, 2017
7753628
docker image: set locale
vidbina Nov 28, 2017
72f81a3
docker image: installed nodejs
vidbina Nov 28, 2017
c09e851
docker image: minimized locale ops to single RUN
vidbina Nov 28, 2017
b3b4b84
Merge branch 'master' into dockerize
vidbina Dec 11, 2017
e8eb664
Merge branch 'master' into dockerize
benbalter Mar 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ruby:2.4

RUN apt-get update \
&& apt-get install -y \
git \
make

COPY . /gh-pages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to how Jekyll.sanitized_path works, let's put this in a subdirectory 2 levels deep, e.g. /gh/pages or /src/gh-pages. Otherwise, if you have a file called gh-pages.html, you'll get an error. It's confusing so let's tackle that before merging.

Copy link
Contributor Author

@vidbina vidbina Nov 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like cbe4cdf?

WORKDIR /gh-pages

RUN bundle config local.github-pages /gh-pages
RUN bundle install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to modify the Gemfile to add the Gem to the jekyll_plugins group so that it can hook earlier into the bootstrap process and set defaults, e.g., gem "github-pages", group: :jekyll_plugins

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I totally understand what you mean with this, please elaborate and I'll try to get on it asap 😉.

My GitHub Pages projects do contain the gem "github-pages", group: :jekyll_plugins line, but then I believe I should then probably fire up "bundle exec jekyll server ..." instead of just "jekyll serve ...".

Is there any logic performed on the jekyll_plugins group? Is it not only there for organization?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any logic performed on the jekyll_plugins group? Is it not only there for organization?

The Jekyll Plugins group allows the GitHub Pages Gem to get bootstrapped earlier in Jekyll's process and set configuration defaults and constraints to match GitHub Pages. I'm struggling to load a gemspec into a gem group, so we may need to create a new / modify the Gemfile for docker.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you guys figures this out in the end? It seems to me that jekyll in the container ignores github-pages entirely and just uses its own default configuration, making this whole make server and contrib/func.sh thing rather useless. :-/


CMD ["jekyll", "serve", "-H", "0.0.0.0", "-P", "4000"]
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
DOCKER=docker

TAG=gh-pages

# Build the docker image
image:
${DOCKER} build -t ${TAG} .

# Produce a bash shell
shell:
${DOCKER} run --rm -it \
-p 4000:4000 \
-v ${PWD}:/gh-pages \
${TAG} \
/bin/bash

# Spawn a server. Specify the path to the SITE directory by
# exposing it using `expose SITE="../path-to-jekyll-site"` prior to calling or
# by prepending it to the make rule e.g.: `SITE=../path-to-site make server`
server:
ls "${SITE}" >/dev/null && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can an error message be printed here if the SITE variable doesn't exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will an echo suffice? 03709aa

${DOCKER} run --rm -it \
-p 4000:4000 \
-v ${PWD}:/gh-pages \
-v `realpath ${SITE}`:/site \
-w /site \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use /src/site (a subdirectory 2 levels deep) for reasons stated above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 😉 9d8fe18

${TAG}

.PHONY:
image server shell