23 lines
929 B
YAML
23 lines
929 B
YAML
|
docker:
|
||
|
- image: circleci/buildpack-deps
|
||
|
shell: /usr/bin/env bash -euo pipefail -c
|
||
|
steps:
|
||
|
- checkout
|
||
|
- setup_remote_docker
|
||
|
- run:
|
||
|
name: Diff package-lock.json
|
||
|
command: |
|
||
|
echo 'export PACKAGE_LOCK_CHANGED=$(git diff --name-only $(git log --pretty=format:'%h' -n1 HEAD~1)...HEAD | grep -c website/package-lock.json)' >> $BASH_ENV
|
||
|
- run:
|
||
|
name: Build Docker Image if Necessary
|
||
|
command: |
|
||
|
if [ "$CIRCLE_BRANCH" = "master" ] && [ $PACKAGE_LOCK_CHANGED -gt 0 ]; then
|
||
|
cd website/
|
||
|
docker build -t hashicorp/nomad-website:$CIRCLE_SHA1 .
|
||
|
docker tag hashicorp/nomad-website:$CIRCLE_SHA1 hashicorp/nomad-website:latest
|
||
|
docker login -u $DOCKER_USER -p $DOCKER_PASS
|
||
|
docker push hashicorp/nomad-website
|
||
|
else
|
||
|
echo "Not building a new website docker image - branch is not master and/or dependencies have not changed."
|
||
|
fi
|