mirror of https://github.com/status-im/consul.git
circle docker image config
This commit is contained in:
parent
cc19b88288
commit
7ecec91869
|
@ -362,101 +362,30 @@ jobs:
|
||||||
NOMAD_VERSION: master
|
NOMAD_VERSION: master
|
||||||
steps: *NOMAD_INTEGRATION_TEST_STEPS
|
steps: *NOMAD_INTEGRATION_TEST_STEPS
|
||||||
|
|
||||||
build-website:
|
build-website-docker-image:
|
||||||
# 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:
|
docker:
|
||||||
- image: *MIDDLEMAN_IMAGE
|
- image: circleci/buildpack-deps
|
||||||
steps:
|
shell: /usr/bin/env bash -euo pipefail -c
|
||||||
- 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
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
# attach website build directory
|
- setup_remote_docker
|
||||||
- attach_workspace:
|
- run:
|
||||||
at: ~/project/website
|
name: Build Docker Image if Necessary
|
||||||
- run: ./website/scripts/link-check.sh
|
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
|
# build frontend yarn cache
|
||||||
frontend-cache:
|
frontend-cache:
|
||||||
|
@ -730,21 +659,11 @@ workflows:
|
||||||
|
|
||||||
website:
|
website:
|
||||||
jobs:
|
jobs:
|
||||||
- build-website
|
- build-website-docker-image:
|
||||||
- docs-link-checker:
|
|
||||||
requires:
|
|
||||||
- build-website
|
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore:
|
only:
|
||||||
- /^pull\/.*$/ # only run link checker on non forks
|
- master
|
||||||
- deploy-website:
|
|
||||||
requires:
|
|
||||||
- docs-link-checker
|
|
||||||
context: static-sites
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only: stable-website
|
|
||||||
frontend:
|
frontend:
|
||||||
jobs:
|
jobs:
|
||||||
- frontend-cache:
|
- frontend-cache:
|
||||||
|
|
Loading…
Reference in New Issue