circle docker image config
This commit is contained in:
parent
be78f98a6c
commit
6945548f42
|
@ -362,101 +362,30 @@ jobs:
|
|||
NOMAD_VERSION: master
|
||||
steps: *NOMAD_INTEGRATION_TEST_STEPS
|
||||
|
||||
build-website:
|
||||
# setting the working_directory along with the checkout path allows us to not have
|
||||
# to cd into the website/ directory for commands
|
||||
working_directory: ~/project/website
|
||||
build-website-docker-image:
|
||||
docker:
|
||||
- image: *MIDDLEMAN_IMAGE
|
||||
steps:
|
||||
- checkout:
|
||||
path: ~/project
|
||||
|
||||
# restores gem cache
|
||||
- restore_cache:
|
||||
key: *RUBYGEM_CACHE_KEY
|
||||
|
||||
- run:
|
||||
name: install gems
|
||||
command: bundle check || bundle install --path vendor/bundle --retry=3
|
||||
|
||||
# saves gem cache if we have changed the Gemfile
|
||||
- save_cache:
|
||||
key: *RUBYGEM_CACHE_KEY
|
||||
paths:
|
||||
- ~/project/website/vendor/bundle
|
||||
|
||||
# exclude guides directory since they moved to learn.hashicorp.com
|
||||
# keep index.html which points to learn
|
||||
- run:
|
||||
name: exclude guides
|
||||
command: find ./source/docs/guides -type f -not -name 'index.html.md' -delete
|
||||
|
||||
- run:
|
||||
name: middleman build
|
||||
command: bundle exec middleman build
|
||||
|
||||
- run:
|
||||
name: add missing tar binary
|
||||
command: apk update && apk add tar
|
||||
|
||||
# saves website build directory
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- build
|
||||
|
||||
deploy-website:
|
||||
# setting the working_directory along with the checkout path allows us to not have
|
||||
# to cd into the website/ directory for commands
|
||||
working_directory: ~/project/website
|
||||
docker:
|
||||
- image: *MIDDLEMAN_IMAGE
|
||||
steps:
|
||||
- checkout:
|
||||
path: ~/project
|
||||
|
||||
- run:
|
||||
name: add missing tar binary
|
||||
command: apk update && apk add tar
|
||||
|
||||
# attach website build directory
|
||||
- attach_workspace:
|
||||
at: ~/project/website
|
||||
|
||||
# restores gem cache
|
||||
- restore_cache:
|
||||
key: *RUBYGEM_CACHE_KEY
|
||||
# rerun build with 'ENV=production' to add analytics
|
||||
- run:
|
||||
name: install gems
|
||||
command: bundle check || bundle install --path vendor/bundle --retry=3
|
||||
|
||||
# exclude guides directory since they moved to learn.hashicorp.com
|
||||
# keep index.html which points to learn
|
||||
- run:
|
||||
name: exclude guides
|
||||
command: find ./source/docs/guides -type f -not -name 'index.html.md' -delete
|
||||
|
||||
# rerun build with 'ENV=production' to add analytics
|
||||
- run:
|
||||
name: middleman build
|
||||
command: bundle exec middleman build
|
||||
|
||||
- run:
|
||||
name: website deploy
|
||||
command: ./scripts/deploy.sh
|
||||
|
||||
# Link check on a temporary netlify deployed site
|
||||
docs-link-checker:
|
||||
docker:
|
||||
- image: circleci/node:lts
|
||||
- image: circleci/buildpack-deps
|
||||
shell: /usr/bin/env bash -euo pipefail -c
|
||||
steps:
|
||||
- checkout
|
||||
# attach website build directory
|
||||
- attach_workspace:
|
||||
at: ~/project/website
|
||||
- run: ./website/scripts/link-check.sh
|
||||
- setup_remote_docker
|
||||
- run:
|
||||
name: Build Docker Image if Necessary
|
||||
command: |
|
||||
# Ignore job if running an enterprise build
|
||||
IMAGE_TAG=$(cat website/Dockerfile website/package-lock.json | sha256sum | awk '{print $1;}')
|
||||
echo "Using $IMAGE_TAG"
|
||||
if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/consul.git" ]; then
|
||||
echo "Not Consul OSS Repo, not building website docker image"
|
||||
elif curl https://hub.docker.com/v2/repositories/hashicorp/consul-website/tags/$IMAGE_TAG -fsL > /dev/null; then
|
||||
echo "Dependencies have not changed, not building a new website docker image."
|
||||
else
|
||||
cd website/
|
||||
docker build -t hashicorp/consul-website:$IMAGE_TAG .
|
||||
docker tag hashicorp/consul-website:$IMAGE_TAG hashicorp/consul-website:latest
|
||||
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
|
||||
docker push hashicorp/consul-website
|
||||
fi
|
||||
|
||||
# build frontend yarn cache
|
||||
frontend-cache:
|
||||
|
@ -730,21 +659,11 @@ workflows:
|
|||
|
||||
website:
|
||||
jobs:
|
||||
- build-website
|
||||
- docs-link-checker:
|
||||
requires:
|
||||
- build-website
|
||||
- build-website-docker-image:
|
||||
filters:
|
||||
branches:
|
||||
ignore:
|
||||
- /^pull\/.*$/ # only run link checker on non forks
|
||||
- deploy-website:
|
||||
requires:
|
||||
- docs-link-checker
|
||||
context: static-sites
|
||||
filters:
|
||||
branches:
|
||||
only: stable-website
|
||||
only:
|
||||
- master
|
||||
frontend:
|
||||
jobs:
|
||||
- frontend-cache:
|
||||
|
|
Loading…
Reference in New Issue