Skip to content

Instantly share code, notes, and snippets.

@jsoendermann
Last active June 27, 2018 04:17
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 jsoendermann/bff0054a85025865c2866072016098a4 to your computer and use it in GitHub Desktop.
Save jsoendermann/bff0054a85025865c2866072016098a4 to your computer and use it in GitHub Desktop.
Serve jekyll site with nginx
FROM alpine:3.7 as build-env
MAINTAINER Jan Soendermann
# This list of packages was taken from the official jekyll image.
# Some of them are probably not required but since this is
# just a build env, it doesn't matter so much.
RUN \
apk --update add readline readline-dev libxml2 libxml2-dev libxslt \
libxslt-dev python zlib zlib-dev ruby ruby-dev yaml \
yaml-dev libffi libffi-dev build-base nodejs ruby-io-console \
ruby-irb ruby-json ruby-rake ruby-rdoc ruby-dev
RUN gem install bundler -v 1.16.1 --no-document
RUN bundle config --global silence_root_warning 1
RUN echo "gem: --no-rdoc --no-ri" > ~/.gemrc
WORKDIR /jekyll
COPY Gemfile .
COPY Gemfile.lock .
RUN bundle install --jobs 3
COPY . .
RUN bundle exec jekyll build --destination /site
FROM nginx:1.15.0
COPY --from=build-env /site /usr/share/nginx/html
EXPOSE 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment