Skip to content

Instantly share code, notes, and snippets.

@sreecodeslayer
Last active July 5, 2019 12:20
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 sreecodeslayer/629e8f67b7ec373b1b6cf9be9867d6f3 to your computer and use it in GitHub Desktop.
Save sreecodeslayer/629e8f67b7ec373b1b6cf9be9867d6f3 to your computer and use it in GitHub Desktop.
Jekyll docker file and NGINX default configuration
# ============================================================
# Build your jekyll blog
# ============================================================
FROM jekyll/jekyll:stable AS build
RUN mkdir /jekyll-minima
WORKDIR /jekyll-minima
# copy the blog source
COPY . .
# permission for bundle to write gemfile.lock
RUN chmod 777 ./
# Install dependencies
RUN bundle install
# Build
RUN bundle exec jekyll build
# ============================================================
# Serve the build files with NGINX
# ============================================================
FROM nginx as nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy build files of the blog
COPY --from=build /jekyll-minima/_site /usr/share/nginx/html
EXPOSE 80
server {
listen 80 default_server;
root /usr/share/nginx/html;
index index.html
# how long should static files be cached for,
# see http://nginx.org/en/docs/http/ngx_http_headers_module.html for options.
expires 1d;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment