From cf65f25ca974dc1da2298cd3a5c93650251ee9c5 Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Fri, 2 Dec 2016 14:13:32 -0800 Subject: [PATCH] dockerfile: change to alpine base and cleanup This makes the image a lot smaller and it's using an official image as the base to make sure we get security updates etc. The image size went from: ``` REPOSITORY SIZE gcr.io/google-samples/k8sdocs 837 MB ``` To: ``` REPOSITORY SIZE gcr.io/google-samples/k8sdocs 227 MB ``` Signed-off-by: Jess Frazelle --- staging-container/Dockerfile | 21 +++++++++++++++++---- staging-container/start.sh | 7 +++++++ 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100755 staging-container/start.sh diff --git a/staging-container/Dockerfile b/staging-container/Dockerfile index a5b41625b5..cb0d6a0f70 100644 --- a/staging-container/Dockerfile +++ b/staging-container/Dockerfile @@ -1,13 +1,26 @@ -FROM starefossen/ruby-node:2-4 +FROM alpine:3.3 -RUN gem install github-pages +RUN apk add --no-cache \ + build-base \ + ca-certificates \ + libffi-dev \ + nodejs \ + ruby-dev \ + ruby-nokogiri \ + zlib-dev + +RUN gem install \ + bundler \ + github-pages \ + io-console \ + --no-rdoc --no-ri VOLUME /k8sdocs EXPOSE 4000 +COPY start.sh /start.sh WORKDIR /k8sdocs -CMD bundle && jekyll clean && jekyll serve -H 0.0.0.0 -P 4000 - +CMD [ "/start.sh" ] # For instructions, see http://kubernetes.io/editdocs/ diff --git a/staging-container/start.sh b/staging-container/start.sh new file mode 100755 index 0000000000..890e4bb385 --- /dev/null +++ b/staging-container/start.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +set -x + +bundle +bundle exec jekyll clean +bundle exec jekyll serve -H 0.0.0.0 -P 4000