Skip to content

Instantly share code, notes, and snippets.

@zsmahi
Created July 15, 2023 22:10
Show Gist options
  • Save zsmahi/d1236987ba560f26ef6a1c087ab84540 to your computer and use it in GitHub Desktop.
Save zsmahi/d1236987ba560f26ef6a1c087ab84540 to your computer and use it in GitHub Desktop.
Deploying a Jekyll Website Using Docker
# Use an official Ruby runtime as a parent image
FROM ruby:3.2.2-bookworm
# Install Node.js for some js dependencies
RUN apt-get update -qq && apt-get install -y nodejs
# Install Jekyll and Bundler
RUN gem install bundler jekyll
# Set the working directory in the image to /app
WORKDIR /app
# Add the current directory (inside jekyll site folder) contents into the container at /app
ADD . /app
# Install any needed packages specified in Gemfile
RUN bundle install
# Make port 4000 available outside this container
EXPOSE 4000
#optionnal:
ENV NAME World
# Run Jekyll when the container launches
CMD ["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