FROM ruby:3.0.0 as jekyll RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # used in the jekyll-server image, which is FROM this image COPY docker-entrypoint.sh /usr/local/bin/ RUN gem update --system && gem install jekyll && gem cleanup EXPOSE 4000 WORKDIR /site ENTRYPOINT [ "jekyll" ] CMD [ "--help" ] # build from the image we just built with different metadata FROM jekyll as jekyll-serve COPY --from=jekyll /usr/local/bin/docker-entrypoint.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-entrypoint.sh # on every container start, check if Gemfile exists and warn if it's missing ENTRYPOINT [ "docker-entrypoint.sh" ] CMD [ "bundle", "exec", "jekyll", "serve", "--force_polling", "-H", "0.0.0.0", "-P", "4000" ]