Skip to content

CI errors be gone

CI errors be gone #629

Workflow file for this run

name: Docker
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- main
paths:
- "Dockerfile"
- ".dockerignore"
- "pyproject.toml"
push:
tags:
- "v*.*.*"
jobs:
build:
name: Build (${{ matrix.build.tag }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build:
- base_image: ghcr.io/allenai/pytorch:1.12.1-cuda11.3-python3.9
tag: cuda11.3
env:
IMAGE_NAME: ghcr.io/allenai/tango
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: |
docker build --build-arg BASE_IMAGE=${{ matrix.build.base_image }} -t "${IMAGE_NAME}:${{ matrix.build.tag }}" .
- name: Test Docker image
run: |
docker run --rm "${IMAGE_NAME}:${{ matrix.build.tag }}" info
- name: Log in to ghcr.io
if: github.event_name != 'pull_request'
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push latest to ghcr.io
if: github.event_name != 'pull_request'
run: |
docker push "${IMAGE_NAME}:${{ matrix.build.tag }}"
- name: Push release version to ghcr.io
if: startsWith(github.ref, 'refs/tags/')
run: |
GITHUB_TAG=${GITHUB_REF#refs/tags/}
docker tag "${IMAGE_NAME}:${{ matrix.build.tag }}" "${IMAGE_NAME}:${GITHUB_TAG}-${{ matrix.build.tag }}"
docker push "${IMAGE_NAME}:${GITHUB_TAG}-${{ matrix.build.tag }}"