2020-01-18 00:18:09 +00:00
|
|
|
docker:
|
|
|
|
- image: circleci/buildpack-deps
|
|
|
|
shell: /usr/bin/env bash -euo pipefail -c
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- setup_remote_docker
|
|
|
|
- run:
|
|
|
|
name: Build Docker Image if Necessary
|
|
|
|
command: |
|
2020-03-06 18:50:38 +00:00
|
|
|
IMAGE_TAG="$(git rev-list -n1 HEAD -- website/Dockerfile website/package-lock.json)"
|
|
|
|
echo "Using $IMAGE_TAG"
|
2020-03-30 19:52:28 +00:00
|
|
|
if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/vault.git" ]; then
|
2020-03-06 18:50:38 +00:00
|
|
|
echo "Not Vault OSS Repo, not building website docker image"
|
|
|
|
elif curl https://hub.docker.com/v2/repositories/hashicorp/vault-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/vault-website:$IMAGE_TAG .
|
|
|
|
docker tag hashicorp/vault-website:$IMAGE_TAG hashicorp/vault-website:latest
|
|
|
|
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
|
|
|
|
docker push hashicorp/vault-website
|
|
|
|
fi
|