1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

Fix Build Self-Host workflow (#2437)

This commit is contained in:
Vince Grassia 2022-11-23 13:48:09 -05:00 committed by GitHub
parent 93afa93b85
commit 52144c5bf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325
########## Build Docker Image ##########
########## Login to Docker registries ##########
- name: Login to Azure - QA Subscription
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
with:
@ -34,38 +34,6 @@ jobs:
- name: Login to Azure ACR
run: az acr login -n bitwardenqa
- name: Generate Docker image tag
id: tag
run: |
IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") # slash safe branch name
if [[ "$IMAGE_TAG" == "master" ]]; then
IMAGE_TAG=dev
fi
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Build Docker image
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
context: .
file: docker-unified/Dockerfile
platforms: |
linux/amd64,
linux/arm/v7,
linux/arm64/v8
push: true
tags: bitwardenqa.azurecr.io/self-host:${{ steps.tag.outputs.image_tag }}
- name: Pull new image
env:
PROJECT_NAME: self-host
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }}
run: docker pull bitwardenqa.azurecr.io/${PROJECT_NAME}:${IMAGE_TAG}
- name: Log out of Docker
run: docker logout
########## DockerHub ##########
- name: Login to Azure - Prod Subscription
if: |
(github.ref == 'refs/heads/master' ||
@ -115,18 +83,39 @@ jobs:
echo "DOCKER_CONTENT_TRUST=1" >> $GITHUB_ENV
echo "DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=$DCT_REPO_PASSPHRASE" >> $GITHUB_ENV
- name: Tag and Push image to Docker Hub
if: |
(github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/rc' ||
github.ref == 'refs/heads/hotfix-rc')
########## Generate image tag and build Docker image ##########
- name: Generate Docker image tag
id: tag
run: |
IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") # slash safe branch name
if [[ "$IMAGE_TAG" == "master" ]]; then
IMAGE_TAG=dev
fi
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Generate tag list
id: tag-list
env:
PROJECT_NAME: self-host
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }}
run: |
docker tag bitwardenqa.azurecr.io/${PROJECT_NAME}:${IMAGE_TAG} \
bitwarden/${PROJECT_NAME}:${IMAGE_TAG}
docker push bitwarden/${PROJECT_NAME}:${IMAGE_TAG}
if [ "$IMAGE_TAG" = "dev" ]; then
echo "tags=bitwardenqa.azurecr.io/self-host:${IMAGE_TAG},bitwarden/self-host:${IMAGE_TAG}" >> $GITHUB_OUTPUT
else
echo "tags=bitwardenqa.azurecr.io/self-host:${IMAGE_TAG}" >> $GITHUB_OUTPUT
fi
- name: Build Docker image
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
context: .
file: docker-unified/Dockerfile
platforms: |
linux/amd64,
linux/arm/v7,
linux/arm64/v8
push: true
tags: ${{ steps.tag-list.outputs.tags }}
- name: Log out of Docker and disable Docker Notary
if: |