github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/.circleci/config/jobs/website-docker-image.yml (about)

     1  docker:
     2    - image: circleci/buildpack-deps
     3  shell: /usr/bin/env bash -euo pipefail -c
     4  steps:
     5    - checkout
     6    - setup_remote_docker
     7    - run:
     8        name: Build Docker Image if Necessary
     9        command: |
    10          # There is an edge case that would cause an issue here - if dependencies are updated to an exact copy
    11          # of a previous version, for example if packge-lock.json is reverted, we need to manually push the new
    12          # image to the "latest" tag
    13          # Ignore job if running an enterprise build
    14          IMAGE_TAG=$(cat website/Dockerfile website/package-lock.json | sha256sum | awk '{print $1;}')
    15          echo "Using $IMAGE_TAG"
    16          if  [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/nomad.git" ]; then
    17            echo "Not Nomad OSS Repo, not building website docker image"
    18          elif curl https://hub.docker.com/v2/repositories/hashicorp/nomad-website/tags/$IMAGE_TAG -fsL > /dev/null; then
    19              echo "Dependencies have not changed, not building a new website docker image."
    20          else
    21              cd website/
    22              docker build -t hashicorp/nomad-website:$IMAGE_TAG .
    23              docker tag hashicorp/nomad-website:$IMAGE_TAG hashicorp/nomad-website:latest
    24              docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
    25              docker push hashicorp/nomad-website
    26          fi