FROM nginx:alpine
MAINTAINER Maxime Epain "me@maxep.me"

EXPOSE 80

# Packages
RUN apk --no-cache add \
  ruby \
  ruby-dev \
  ruby-irb \
  ruby-rdoc \
  ruby-bigdecimal

RUN apk --no-cache add \
  zlib-dev \
  build-base \
  libxml2-dev \
  libxslt-dev \
  readline-dev \
  libffi-dev \
  yaml-dev \
  zlib-dev \
  libffi-dev \
  cmake

RUN apk --no-cache add \
  linux-headers \
  openjdk8-jre \
  less \
  zlib \
  libxml2 \
  readline \
  libxslt \
  libffi \
  git \
  nodejs \
  tzdata \
  shadow \
  bash \
  su-exec \
  nodejs-npm \
  libressl \
  yarn

# Install jekyll
RUN gem install jekyll bundler

# --
RUN addgroup -Sg 1000 jekyll
RUN adduser  -Su 1000 -G \
  jekyll jekyll

# Add site
COPY . /home/app/site
RUN chown -R jekyll:jekyll /home/app/site

# Build the site with Jekyll
WORKDIR /home/app/site
RUN jekyll build

# Copy site
COPY _site/ /usr/share/nginx/html