diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000000..3fea160925 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,28 @@ +version: 2 +jobs: + build: + docker: + - image: gcr.io/istio-testing/website-builder:2018-06-15 + + working_directory: ~/site + + steps: + - checkout + + - run: + name: Generating Site + command: scripts/gen_site.sh "" + + - restore_cache: + keys: + - htmlproofer-cache-v4 + + - run: + name: Running Linters + command: scripts/lint_site.sh + + # save the external URLs cache + - save_cache: + key: htmlproofer-cache-v4 + paths: + - .htmlproofer diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index c06db51516..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM alpine:latest - -RUN apk add --no-cache \ - nodejs \ - ruby \ - ruby-dev \ - hugo \ - build-base \ - gcc \ - libc-dev \ - zlib-dev \ - libxslt-dev \ - libxml2-dev \ - git && \ - apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted gnu-libiconv - -RUN npm install -g \ - html-minifier \ - sass \ - uglify-js \ - markdown-spellcheck - -RUN gem install --no-ri --no-rdoc \ - mdl \ - html-proofer - -ENV PATH /usr/bin:$PATH - -# TODO: replace with your ENTRYPOINT or CMD. -CMD [ "/usr/bin/ruby", "-v"] diff --git a/scripts/Dockerfile b/scripts/Dockerfile new file mode 100644 index 0000000000..6f376f968e --- /dev/null +++ b/scripts/Dockerfile @@ -0,0 +1,42 @@ +FROM ruby:2.4-alpine + +RUN echo 'gem: --no-document' >> /etc/gemrc + +RUN apk add --no-cache \ + nodejs \ + ruby \ + ruby-dev \ + build-base \ + gcc \ + libc-dev \ + zlib-dev \ + libxslt-dev \ + libxml2-dev \ + libcurl \ + git \ + && apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted gnu-libiconv + +ENV HUGO_VERSION=0.42.1 +ADD https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz /tmp +RUN tar -xf /tmp/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz -C /tmp \ + && mkdir -p /usr/local/sbin \ + && mv /tmp/hugo /usr/local/sbin/hugo \ + && rm -rf /tmp/hugo_${HUGO_VERSION}_linux_amd64 \ + && rm -rf /tmp/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz \ + && rm -rf /tmp/LICENSE.md \ + && rm -rf /tmp/README.md + +RUN npm install -g \ + html-minifier \ + sass \ + uglify-js \ + markdown-spellcheck + +RUN gem install \ + mdl \ + html-proofer + +ENV PATH /usr/bin:$PATH + +# TODO: replace with your ENTRYPOINT or CMD. +CMD [ "/usr/bin/ruby", "-v"] diff --git a/scripts/build_and_push_docker.sh b/scripts/build_and_push_docker.sh new file mode 100755 index 0000000000..83e1ea7e24 --- /dev/null +++ b/scripts/build_and_push_docker.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +HUB=gcr.io/istio-testing +VERSION=$(date +%Y-%m-%d) + +docker build --no-cache -t $HUB/website-builder:$VERSION . +gcloud docker -- push $HUB/website-builder:$VERSION diff --git a/scripts/build_site.sh b/scripts/build_site.sh new file mode 100755 index 0000000000..4e49c17cd7 --- /dev/null +++ b/scripts/build_site.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +sass src/sass/light_theme_archive.scss light_theme_archive.css -s compressed +sass src/sass/light_theme_normal.scss light_theme_normal.css -s compressed +sass src/sass/light_theme_preliminary.scss light_theme_preliminary.css -s compressed +sass src/sass/dark_theme_archive.scss dark_theme_archive.css -s compressed +sass src/sass/dark_theme_normal.scss dark_theme_normal.css -s compressed +sass src/sass/dark_theme_preliminary.scss dark_theme_preliminary.css -s compressed +mv light_theme* static/css +mv dark_theme* static/css +uglifyjs src/js/misc.js src/js/prism.js --mangle --compress -o static/js/all.min.js --source-map +uglifyjs src/js/styleSwitcher.js --mangle --compress -o static/js/styleSwitcher.min.js --source-map diff --git a/scripts/gen_site.sh b/scripts/gen_site.sh new file mode 100755 index 0000000000..98a261fcc5 --- /dev/null +++ b/scripts/gen_site.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +hugo --baseURL "$1" +html-minifier --input-dir public --output-dir public --file-ext html --collapse-whitespace --minify-js --minify-css --sort-attributes --sort-class-name --remove-attribute-quotes --remove-comments diff --git a/scripts/lint_site.sh b/scripts/lint_site.sh new file mode 100755 index 0000000000..7bb58f4586 --- /dev/null +++ b/scripts/lint_site.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +mdspell --en-us --ignore-acronyms --ignore-numbers --no-suggestions --report content/*.md content/*/*.md content/*/*/*.md content/*/*/*/*.md content/*/*/*/*/*.md content/*/*/*/*/*/*.md content/*/*/*/*/*/*/*.md +mdl --ignore-front-matter --style mdl_style.rb . +htmlproofer ./public --check-html --assume-extension --timeframe 2d --storage-dir .htmlproofer --url-ignore "/localhost/,/github.com/istio/istio.github.io/edit/master/,/github.com/istio/istio/issues/new/choose/" diff --git a/scripts/serve_site.sh b/scripts/serve_site.sh new file mode 100755 index 0000000000..7756336be3 --- /dev/null +++ b/scripts/serve_site.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +hugo serve --disableFastRender