-
Notifications
You must be signed in to change notification settings - Fork 3
37 lines (34 loc) · 1.29 KB
/
docker-build.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
37
name: Docker Image CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.0.0
- name: Build the Docker image
run: docker build --file Dockerfile --tag vprodemo.azurecr.io/console:latest --tag vprodemo.azurecr.io/console:${{ github.sha }} .
- name: Docker Login
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: vprodemo.azurecr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
logout: true
- name: Push the Docker image to the registry
if: ${{ github.ref == 'refs/heads/main' }}
run: docker push vprodemo.azurecr.io/console:latest
- name: Push the Docker image to the registry
if: ${{ github.ref == 'refs/heads/main' }}
run: docker push vprodemo.azurecr.io/console:${{ github.sha }}