-
Notifications
You must be signed in to change notification settings - Fork 4
60 lines (51 loc) · 2.02 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
name: "build images"
on: [push, pull_request]
jobs:
docker-build:
strategy:
matrix:
include:
- UBUNTU_VER: 22.04
TORCH_VER: 1.13.0
TORCHVISION_VER: 0.14.0
TORCHAUDIO_VER: 0.13.0
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Set REPO_NAME_LC
run: echo "REPO_NAME_LC=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set ON_MAIN_BRANCH
run: echo "ON_MAIN_BRANCH=$([ "$GITHUB_REF_NAME" == "main" ] && echo true || echo false)" >> $GITHUB_ENV # If it is from the main fork and is main branch
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
if: ${{ env.ON_MAIN_BRANCH }} == 'true'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
build-args: |
UBUNTU_VER=${{ matrix.UBUNTU_VER }}
TORCH_VER=${{ matrix.TORCH_VER }}
TORCHAUDIO_VER=${{ matrix.TORCHAUDIO_VER }}
TORCHVISION_VER=${{ matrix.TORCHVISION_VER }}
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ env.ON_MAIN_BRANCH == 'true' }}
tags: ghcr.io/${{ env.REPO_NAME_LC }}:pytorch-${{ matrix.TORCH_VER }}-torchvision-${{ matrix.TORCHVISION_VER }}-torchaudio-${{ matrix.TORCHAUDIO_VER }}-ubuntu-${{ matrix.UBUNTU_VER }}