Skip to content

Commit

Permalink
ci(docker): use Docker Compose to build image
Browse files Browse the repository at this point in the history
Standardises the method used to build the image, avoiding future naming conflicts and unnecessary rebuilds.

Refs #390
  • Loading branch information
thewilkybarkid committed Jul 22, 2021
1 parent 4d3c3b2 commit 6cf476f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/deploy_prereview-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
DOCKER_BUILDKIT: 1
IMAGE_TAG: ${{ github.sha }}

jobs:
build-and-deploy:
Expand All @@ -32,14 +33,14 @@ jobs:
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: 'Build image'
run: docker build . -t prereview.azurecr.io/prereview:${{ github.sha }}
run: docker-compose build prereview

- name: 'Tag image'
run: docker tag prereview.azurecr.io/prereview:${{ github.sha }} prereview.azurecr.io/prereview:develop
run: docker tag prereview.azurecr.io/prereview:${IMAGE_TAG} prereview.azurecr.io/prereview:develop

- name: 'Push image'
run: |
docker push prereview.azurecr.io/prereview:${{ github.sha }}
docker push prereview.azurecr.io/prereview:${IMAGE_TAG}
docker push prereview.azurecr.io/prereview:develop
- uses: azure/webapps-deploy@v2
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/deploy_prereview-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
DOCKER_BUILDKIT: 1
IMAGE_TAG: ${{ github.sha }}

jobs:
build-and-deploy:
Expand All @@ -32,14 +33,14 @@ jobs:
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: 'Build image'
run: docker build . -t prereview.azurecr.io/prereview:${{ github.sha }}
run: docker-compose build prereview

- name: 'Tag image'
run: docker tag prereview.azurecr.io/prereview:${{ github.sha }} prereview.azurecr.io/prereview:latest
run: docker tag prereview.azurecr.io/prereview:${IMAGE_TAG} prereview.azurecr.io/prereview:latest

- name: 'Push image'
run: |
docker push prereview.azurecr.io/prereview:${{ github.sha }}
docker push prereview.azurecr.io/prereview:${IMAGE_TAG}
docker push prereview.azurecr.io/prereview:latest
- uses: azure/webapps-deploy@v2
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: "3"
services:
prereview:
image: prereview.azurecr.io/prereview:${IMAGE_TAG:-local}
build: .
depends_on:
- prereview-db
Expand Down

0 comments on commit 6cf476f

Please sign in to comment.