Skip to content

Commit dd1e077

Browse files
committed
circle config
1 parent e9db54a commit dd1e077

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

.circleci/config.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
version: 2
22

33
jobs:
4-
build-website:
5-
# setting the working_directory along with the checkout path allows us to not have
6-
# to cd into the website/ directory for commands
7-
working_directory: ~/project/website
4+
build-website-docker-image:
85
docker:
9-
- image: hashicorp/middleman-hashicorp:0.3.35
6+
- image: circleci/buildpack-deps
7+
shell: /usr/bin/env bash -euo pipefail -c
108
steps:
11-
- checkout:
12-
path: ~/project
13-
- restore_cache:
14-
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
9+
- checkout
10+
- setup_remote_docker
1511
- run:
16-
command: bundle check || bundle install --path vendor/bundle
17-
- save_cache:
18-
key: static-site-gems-v1-{{ checksum "Gemfile.lock" }}
19-
paths:
20-
- ~/project/website/vendor/bundle
21-
- run:
22-
command: bundle exec middleman build
23-
- run:
24-
command: ./scripts/deploy.sh
12+
name: Build Docker Image if Necessary
13+
command: |
14+
IMAGE_TAG=$(cat website/Dockerfile website/package-lock.json | sha256sum | awk '{print $1;}')
15+
echo "Using $IMAGE_TAG"
16+
if curl https://hub.docker.com/v2/repositories/hashicorp/vagrant-website/tags/$IMAGE_TAG -fsL > /dev/null; then
17+
echo "Dependencies have not changed, not building a new website docker image."
18+
else
19+
cd website/
20+
docker build -t hashicorp/vagrant-website:$IMAGE_TAG .
21+
docker tag hashicorp/vagrant-website:$IMAGE_TAG hashicorp/vagrant-website:latest
22+
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
23+
docker push hashicorp/vagrant-website
24+
fi
2525
workflows:
2626
version: 2
27-
website:
27+
build_website_docker_image:
2828
jobs:
29-
- build-website:
30-
context: static-sites
29+
- build-website-docker-image:
3130
filters:
3231
branches:
33-
only: stable-website
32+
only:
33+
- master

0 commit comments

Comments
 (0)