Skip to content

Instantly share code, notes, and snippets.

@jrichardsz
Last active November 21, 2021 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrichardsz/000ac8079d3b20c79e90939247432846 to your computer and use it in GitHub Desktop.
Save jrichardsz/000ac8079d3b20c79e90939247432846 to your computer and use it in GitHub Desktop.
jekyll docker, jekylldocker

Dockerfile

FROM starefossen/ruby-node:2-6-alpine

ENV GITHUB_GEM_VERSION 202
ENV JSON_GEM_VERSION 1.8.6

RUN apk --update add --virtual build_deps \
    build-base ruby-dev libc-dev linux-headers \
  && gem install --verbose --no-document \
    json:${JSON_GEM_VERSION} \
    github-pages:${GITHUB_GEM_VERSION} \
    jekyll-github-metadata \
    minitest \
  && apk del build_deps \
  && apk add git \
  && mkdir -p /usr/src/app \
  && rm -rf /usr/lib/ruby/gems/*/cache/*.gem

WORKDIR /usr/src/app

ADD entrypoint.sh /entrypoint.sh
RUN chmod 744 /entrypoint.sh

# override defaul entrypoint
ENTRYPOINT ["/entrypoint.sh"]
CMD []

entrypoint.sh

#!/bin/ash
cd /usr/src/app
bundle update && bundle install
jekyll serve -H 0.0.0.0 -P 4000

Bild and Run

docker build -t jekyll-server .
docker run --name dev-wiki -p 4000:4000 -v /tmp/my/jekyll-repo:/usr/src/app -d jekyll-server
docker logs dev-wiki -f

http://0.0.0.0:4000/

sample https://github.com/gustavoquinalha/jekyll-help-center-theme

Dockerfile

FROM starefossen/ruby-node:2-6-alpine

ENV GITHUB_GEM_VERSION 202
ENV JSON_GEM_VERSION 1.8.6

RUN apk --update add --virtual build_deps \
    build-base ruby-dev libc-dev linux-headers \
  && gem install --verbose --no-document \
    json:${JSON_GEM_VERSION} \
    github-pages:${GITHUB_GEM_VERSION} \
    jekyll-github-metadata \
    minitest \
  && apk del build_deps \
  && apk add git \
  && mkdir -p /usr/src/app \
  && rm -rf /usr/lib/ruby/gems/*/cache/*.gem

WORKDIR /usr/src/app

#ADD entrypoint.sh /entrypoint.sh
#RUN chmod 744 /entrypoint.sh

COPY . .
RUN bundle update
RUN bundle install
# override defaul entrypoint
#ENTRYPOINT ["/entrypoint.sh"]
CMD ["bundle","exec","jekyll","serve","-H","0.0.0.0","-P","4000"]

Bild and Run

docker build -t jekyll-server .
docker run --name dev-wiki -p 4000:4000 -d jekyll-server
docker logs dev-wiki -f

http://0.0.0.0:4000/

sample https://github.com/gustavoquinalha/jekyll-help-center-theme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment