File tree Expand file tree Collapse file tree 1 file changed +22
-22
lines changed Expand file tree Collapse file tree 1 file changed +22
-22
lines changed Original file line number Diff line number Diff line change 1
1
version : 2
2
2
3
3
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 :
8
5
docker :
9
- - image : hashicorp/middleman-hashicorp:0.3.35
6
+ - image : circleci/buildpack-deps
7
+ shell : /usr/bin/env bash -euo pipefail -c
10
8
steps :
11
- - checkout :
12
- path : ~/project
13
- - restore_cache :
14
- key : static-site-gems-v1-{{ checksum "Gemfile.lock" }}
9
+ - checkout
10
+ - setup_remote_docker
15
11
- 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
25
25
workflows :
26
26
version : 2
27
- website :
27
+ build_website_docker_image :
28
28
jobs :
29
- - build-website :
30
- context : static-sites
29
+ - build-website-docker-image :
31
30
filters :
32
31
branches :
33
- only : stable-website
32
+ only :
33
+ - master
You can’t perform that action at this time.
0 commit comments