ACR login #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- gha | |
env: | |
DOCKER_URL: ${{ contains(github.ref, 'master') && 'todo' || 'uniappsakshopedev.azurecr.io' }} | |
DOCKER_REPOSITORY: hope-backend | |
jobs: | |
main: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to ACR | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.DOCKER_URL }} | |
username: ${{ secrets.AZURE_CLIENT_ID }} | |
password: ${{ secrets.AZURE_CLIENT_SECRET }} | |
- name: Docker build | |
run: | | |
docker buildx create --use | |
docker buildx build \ | |
--cache-from type=registry,ref=$(Docker.url)/$(Docker.backend.repository)-cache:$(tag) \ | |
--cache-from type=registry,ref=$(Docker.url)/$(Docker.backend.repository)-cache:latest \ | |
--cache-to type=registry,ref=$(Docker.url)/$(Docker.backend.repository)-cache:$(tag),mode=max \ | |
--cache-to type=registry,ref=$(Docker.url)/$(Docker.backend.repository)-cache:latest,mode=max \ | |
-t ${{ env.DOCKER_URL }}/${{ env.DOCKER_REPOSITORY }}:${{ github.sha }} \ | |
-f docker/Dockerfile \ | |
--push \ | |
. |