-
Notifications
You must be signed in to change notification settings - Fork 413
104 lines (94 loc) · 3.64 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: "Build (& Push) Dockers"
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: [master]
paths:
- "requirements/*"
- "requirements.txt"
- ".devcontainer/*"
- "dockers/**"
- ".github/workflows/docker-build.yml"
- "setup.py"
pull_request:
branches: [master]
paths:
- "requirements/*"
- "requirements.txt"
- ".devcontainer/*"
- "dockers/**"
- ".github/workflows/docker-build.yml"
- "setup.py"
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
env:
PUSH_DOCKERHUB: ${{ github.ref == 'refs/heads/master' || github.event_name != 'pull_request' }}
jobs:
build-Devcontainer:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to DockerHub
if: env.PUSH_DOCKERHUB == 'true' && github.repository_owner == 'Lightning-AI'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build (and Push) Devcontainer
# publish master/release
uses: docker/build-push-action@v6
with:
build-args: |
VARIANT=${{ matrix.python }}
file: .devcontainer/Dockerfile
push: ${{ env.PUSH_DOCKERHUB }}
tags: "pytorchlightning/torchmetrics:devcontainer-py${{ matrix.python }}"
timeout-minutes: 50
build-cuda:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# These are the base images for PL release docker images,
# so include at least all the combinations in release-dockers.yml.
- { python: "3.10", pytorch: "2.0.1", cuda: "12.1.1", ubuntu: "22.04" }
- { python: "3.11", pytorch: "2.1.2", cuda: "12.1.1", ubuntu: "22.04" }
- { python: "3.11", pytorch: "2.2.2", cuda: "12.1.1", ubuntu: "22.04" }
- { python: "3.11", pytorch: "2.3.1", cuda: "12.1.1", ubuntu: "22.04" }
- { python: "3.11", pytorch: "2.4.1", cuda: "12.1.1", ubuntu: "22.04" }
- { python: "3.11", pytorch: "2.5.0", cuda: "12.1.1", ubuntu: "22.04" }
# the future version - test or RC version
- { python: "3.11", pytorch: "2.6.0", cuda: "12.4.1", ubuntu: "22.04" }
steps:
- uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v3
if: env.PUSH_DOCKERHUB == 'true' && github.repository_owner == 'Lightning-AI'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: shorten Torch version
run: |
# convert 1.10.2 to 1.10
pt_version=$(echo ${{ matrix.pytorch }} | cut -d. -f1,2)
echo "PT_VERSION=$pt_version" >> $GITHUB_ENV
- name: Build (and Push) runner
uses: docker/build-push-action@v6
with:
build-args: |
UBUNTU_VERSION=${{ matrix.ubuntu }}
PYTHON_VERSION=${{ matrix.python }}
PYTORCH_VERSION=${{ matrix.pytorch }}
CUDA_VERSION=${{ matrix.cuda }}
file: dockers/ubuntu-cuda/Dockerfile
push: ${{ env.PUSH_DOCKERHUB }}
tags: "pytorchlightning/torchmetrics:ubuntu${{ matrix.ubuntu }}-cuda${{ matrix.cuda }}-py${{ matrix.python }}-torch${{ env.PT_VERSION }}"
timeout-minutes: 55