diff --git a/.circleci/config.yml b/.circleci/config.yml index 8001a19b22..7831a45a7c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,22 +1,13 @@ version: 2 jobs: - build: + test: docker: - - image: circleci/node:10 + - image: gcr.io/linkerd-io/website-builder:1.1 working_directory: ~/website steps: - checkout - - run: - name: Install dependencies - command: |- - wget https://github.com/gohugoio/hugo/releases/download/v0.54.0/hugo_0.54.0_Linux-64bit.deb - sudo dpkg -i hugo*.deb - curl https://htmltest.wjdp.uk | bash - sudo mv bin/htmltest /usr/local/bin - sudo npm install -g markdownlint-cli - - run: name: Validate markdown command: |- @@ -26,3 +17,35 @@ jobs: name: Check for bad links command: |- make check + + publish: + docker: + - image: gcr.io/linkerd-io/website-builder:1.1 + + working_directory: ~/website + steps: + - checkout + + - run: + name: Configure gcloud cli + command: |- + echo ${GSTOKEN} > /tmp/token.json + gcloud auth activate-service-account --key-file=/tmp/token.json + + - run: + name: Publish + command: |- + make publish + +workflows: + version: 2 + publish: + jobs: + - test + - publish: + requires: + - test + filters: + branches: + only: + - master diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..1d085cacc9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +** diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..bcd7c09313 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM circleci/node:10 + +USER root + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + lsb-core \ + apt-transport-https \ + && export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" \ + && echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" \ + | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \ + && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \ + | apt-key add - \ + && apt-get update \ + && apt-get install -y --no-install-recommends google-cloud-sdk \ + && wget https://github.com/gohugoio/hugo/releases/download/v0.54.0/hugo_extended_0.54.0_Linux-64bit.deb \ + && dpkg -i hugo*.deb \ + && rm hugo*.deb \ + && curl https://htmltest.wjdp.uk | bash \ + && mv bin/htmltest /usr/local/bin \ + && npm install -g markdownlint-cli \ + && rm -rf /var/lib/apt/lists/* + +USER circleci + diff --git a/Makefile b/Makefile index 6c027bda01..cf0ddcfb09 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ export PROJECT ?= linkerd-site RELEASE_URL = https://github.com/linkerd/linkerd2/releases export L5D2_STABLE_VERSION ?= stable-2.2.1 export L5D2_EDGE_VERSION ?= edge-19.2.5 +export BUILD_IMAGE ?= gcr.io/linkerd-io/website-builder:1.1 GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD) GIT_HASH = $(shell git log --pretty=format:'%h' -n 1) @@ -28,7 +29,7 @@ update-version: replace-env-L5D2_STABLE_VERSION replace-env-L5D2_EDGE_VERSION @# Update the version for the %* site .PHONY: deploy-% -deploy-%: tmp/%*/public +deploy-%: tmp/%/public @# Upload a site to the correct bucket. @# Options: @# @@ -129,3 +130,17 @@ has-env-%: .PHONY: clean clean: rm -rf tmp + +.PHONY: update-build-image +update-build-image: docker-build docker-push + @# Build and push the build image + +.PHONY: docker-build +docker-build: + @# Build the build image + docker build -t $(BUILD_IMAGE) . + +.PHONY: docker-push +docker-push: + @# Push the build image + docker push $(BUILD_IMAGE)