-
Notifications
You must be signed in to change notification settings - Fork 6
36 lines (32 loc) · 1.18 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 \
.