build-cpu-docker #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-cpu-docker | |
on: | |
workflow_dispatch: | |
concurrency: | |
group: build-cpu-docker-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-cpu-docker: | |
name: py${{ matrix.python-version }} torch${{ matrix.torch-version }} v${{ matrix.version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.8", "3.9", "3.10"] | |
torch-version: ["1.13.0", "1.13.1", "2.0.0", "2.0.1", "2.1.0", "2.1.1", "2.1.2"] | |
k2-version: ["1.24.4.dev20231220"] | |
kaldifeat-version: ["1.25.3.dev20231221"] | |
version: ["1.1"] | |
steps: | |
# refer to https://github.com/actions/checkout | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Free space | |
shell: bash | |
run: | | |
df -h | |
rm -rf /opt/hostedtoolcache | |
df -h | |
- name: 'Login to GitHub Container Registry' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build docker Image | |
shell: bash | |
run: | | |
cd .github/scripts/docker | |
torch_version=${{ matrix.torch-version }} | |
# see https://pytorch.org/audio/stable/installation.html#compatibility-matrix | |
if [[ $torch_version == 1.13.0 ]]; then | |
torchaudio_version=0.13.0 | |
elif [[ $torch_version == 1.13.1 ]]; then | |
torchaudio_version=0.13.1 | |
elif [[ $torch_version == 2.0.0 ]]; then | |
torchaudio_version=2.0.1 | |
elif [[ $torch_version == 2.0.1 ]]; then | |
torchaudio_version=2.0.2 | |
else | |
torchaudio_version=$torch_version | |
fi | |
echo "torch_version: $torch_version" | |
echo "torchaudio_version: $torchaudio_version" | |
version=${{ matrix.version }} | |
tag=ghcr.io/k2-fsa/icefall:cpu-py${{ matrix.python-version }}-torch${{ matrix.torch-version }}-v$version | |
echo "tag: $tag" | |
docker build \ | |
-t $tag \ | |
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \ | |
--build-arg TORCH_VERSION=$torch_version \ | |
--build-arg TORCHAUDIO_VERSION=$torchaudio_version \ | |
--build-arg K2_VERSION=${{ matrix.k2-version }} \ | |
--build-arg KALDIFEAT_VERSION=${{ matrix.kaldifeat-version }} \ | |
. | |
docker image ls | |
docker push $tag |