Skip to content

Instantly share code, notes, and snippets.

@pgib
Last active April 6, 2023 01:23
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 pgib/44bcd057a1b4fe207c106b46041fa3ec to your computer and use it in GitHub Desktop.
Save pgib/44bcd057a1b4fe207c106b46041fa3ec to your computer and use it in GitHub Desktop.
Run Jekyll in Docker
#!/bin/sh
docker build --tag jekyll:latest .
FROM ruby:3.2-bullseye AS build
WORKDIR /jekyll
RUN bundle config set --global path /vendor
RUN bundle config set --global without development
COPY Gemfile Gemfile.lock /jekyll
RUN bundle install
FROM ruby:3.2-slim-bullseye
COPY --from=build /vendor /vendor
COPY --from=build /root/.bundle /root/.bundle
ENV LANG C.UTF-8
WORKDIR /jekyll
EXPOSE 4000
CMD [ "bundle", "exec", "jekyll", "build" ]
#!/bin/sh
docker run \
--rm \
--volume $(pwd):/jekyll \
jekyll:latest
#!/bin/sh
docker run \
--rm \
-it \
--volume $(pwd):/jekyll \
--publish 4000:4000 \
jekyll:latest \
bundle exec jekyll serve --host 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment