-
Notifications
You must be signed in to change notification settings - Fork 37
47 lines (41 loc) · 1.63 KB
/
docker-image.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
38
39
40
41
42
43
44
45
46
47
name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-push:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Scantools Docker image
run: |
DATE=$(date +%Y-%m-%d)
docker build . --tag ghcr.io/microsoft/lamar-benchmark/scantools:$DATE --target scantools
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
docker tag ghcr.io/microsoft/lamar-benchmark/scantools:$DATE \
ghcr.io/microsoft/lamar-benchmark/scantools:latest
docker push ghcr.io/microsoft/lamar-benchmark/scantools:$DATE
docker push ghcr.io/microsoft/lamar-benchmark/scantools:latest
fi
- name: Build and push Lamar Docker image
run: |
DATE=$(date +%Y-%m-%d)
docker build . --tag ghcr.io/microsoft/lamar-benchmark/lamar:$DATE --target lamar
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
docker tag ghcr.io/microsoft/lamar-benchmark/lamar:$DATE \
ghcr.io/microsoft/lamar-benchmark/lamar:latest
docker push ghcr.io/microsoft/lamar-benchmark/lamar:$DATE
docker push ghcr.io/microsoft/lamar-benchmark/lamar:latest
fi