Skip to content

Commit 465e621

Browse files
authored
Add GH Action to build and publish Docker images (#1390)
* ADD GH Action to build and publish Docker images * Configure GH action for Docker build * Fix image_tag fetching * Fix identation for main steps * Add token envs for GH docker action, fix push all tag_image * Switch to horovod 0.20.3 * Push images on push events * Fix if conditional
1 parent 1b468e5 commit 465e621

File tree

7 files changed

+59
-8
lines changed

7 files changed

+59
-8
lines changed

.github/workflows/docker-publish.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build And Publish Docker Images
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- docker/**
9+
release:
10+
types: [published]
11+
pull_request:
12+
paths:
13+
- docker/**
14+
15+
jobs:
16+
build-publish:
17+
name: Build and Push Docker images to Docker Hub
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Build all Horovod flavoured PyTorch-Ignite images
23+
working-directory: ./docker
24+
run: |
25+
chmod +x ./hvd/build_all.sh
26+
./hvd/build_all.sh
27+
28+
- name: Build all PyTorch-Ignite images
29+
working-directory: ./docker
30+
run: |
31+
chmod +x ./main/build_all.sh
32+
./main/build_all.sh
33+
- name: Build all MS DeepSpeed flavoured PyTorch-Ignite images
34+
working-directory: ./docker
35+
run: |
36+
chmod +x ./msdp/build_all.sh
37+
./msdp/build_all.sh
38+
39+
- name: List built images
40+
working-directory: ./docker
41+
run: docker images | grep pytorchignite
42+
43+
- name: Push all PyTorch-Ignite Docker images
44+
if: github.event_name == 'push'
45+
env:
46+
DOCKER_USER: ${{ secrets.DOCKER_USER }}
47+
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
48+
working-directory: ./docker
49+
run: |
50+
chmod +x ./push_all.sh
51+
./push_all.sh

docker/hvd/Dockerfile.hvd-apex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN echo "Setup NVIDIA Apex" && \
1818

1919
# Build Horovod
2020
RUN apt-get update && apt-get install -y git && \
21-
git clone --recursive --depth 1 --branch v0.20.0 https://github.com/horovod/horovod.git /horovod && \
21+
git clone --recursive --depth 1 --branch v0.20.3 https://github.com/horovod/horovod.git /horovod && \
2222
conda install -y cmake=3.16 nccl=2.7 -c conda-forge && \
2323
cd /horovod && \
2424
HOROVOD_GPU_OPERATIONS=NCCL HOROVOD_NCCL_LINK=SHARED HOROVOD_WITHOUT_MPI=1 HOROVOD_WITH_PYTORCH=1 pip wheel --no-cache-dir . && \

docker/hvd/Dockerfile.hvd-base

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LABEL description="Latest PyTorch, Ignite and Horovod"
66

77
# Build Horovod
88
RUN apt-get update && apt-get install -y git && \
9-
git clone --recursive --depth 1 --branch v0.20.0 https://github.com/horovod/horovod.git /horovod && \
9+
git clone --recursive --depth 1 --branch v0.20.3 https://github.com/horovod/horovod.git /horovod && \
1010
conda install -y cmake=3.16 nccl=2.7 -c conda-forge && \
1111
cd /horovod && \
1212
HOROVOD_GPU_OPERATIONS=NCCL HOROVOD_NCCL_LINK=SHARED HOROVOD_WITHOUT_MPI=1 HOROVOD_WITH_PYTORCH=1 pip wheel --no-cache-dir . && \

docker/hvd/build_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set -xeu
1717
image_name="hvd-base"
1818

1919
docker build -t pytorchignite/${image_name}:latest -f Dockerfile.${image_name} .
20-
image_tag=`docker run --rm -it pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
20+
image_tag=`docker run --rm -i pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
2121
docker tag pytorchignite/${image_name}:latest pytorchignite/${image_name}:${image_tag}
2222

2323
for image_name in "hvd-vision" "hvd-nlp" "hvd-apex" "hvd-apex-vision" "hvd-apex-nlp"

docker/main/build_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set -xeu
1717
image_name="base"
1818

1919
docker build -t pytorchignite/${image_name}:latest -f Dockerfile.${image_name} .
20-
image_tag=`docker run --rm -it pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
20+
image_tag=`docker run --rm -i pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
2121
docker tag pytorchignite/${image_name}:latest pytorchignite/${image_name}:${image_tag}
2222

2323
for image_name in "vision" "nlp" "apex" "apex-vision" "apex-nlp"

docker/msdp/build_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set -xeu
1717
image_name="msdp-apex-base"
1818

1919
docker build -t pytorchignite/${image_name}:latest -f Dockerfile.${image_name} .
20-
image_tag=`docker run --rm -it pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
20+
image_tag=`docker run --rm -i pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
2121
docker tag pytorchignite/${image_name}:latest pytorchignite/${image_name}:${image_tag}
2222

2323
for image_name in "msdp-apex-vision" "msdp-apex-nlp"

docker/push_all.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo $DOCKER_TOKEN | docker login --username=$DOCKER_USER --password-stdin
2121
set -xeu
2222

2323
image_name="base"
24-
image_tag=`docker run --rm -it pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
24+
image_tag=`docker run --rm -i pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
2525

2626
for image_name in "base" "vision" "nlp" "apex" "apex-vision" "apex-nlp"
2727
do
@@ -33,7 +33,7 @@ done
3333

3434

3535
image_name="hvd-base"
36-
image_tag=`docker run --rm -it pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
36+
image_tag=`docker run --rm -i pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
3737

3838
for image_name in "hvd-base" "hvd-vision" "hvd-nlp" "hvd-apex" "hvd-apex-vision" "hvd-apex-nlp"
3939
do
@@ -44,7 +44,7 @@ do
4444
done
4545

4646
image_name="msdp-apex-base"
47-
image_tag=`docker run --rm -it pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
47+
image_tag=`docker run --rm -i pytorchignite/${image_name}:latest -c 'python -c "import torch; import ignite; print(torch.__version__ + \"-\" + ignite.__version__, end=\"\")"'`
4848

4949
for image_name in "msdp-apex-base" "msdp-apex-vision" "msdp-apex-nlp"
5050
do

0 commit comments

Comments
 (0)