This repository has been archived by the owner on Feb 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
43 lines (40 loc) · 1.58 KB
/
docker-builds.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
name: Publish Docker Image
# https://www.docker.com/blog/first-docker-github-action-is-here
# https://github.com/docker/build-push-action
on: # Trigger the workflow on push or pull request, but only for the master branch
push: {}
pull_request:
branches: [master]
types: [opened, reopened, ready_for_review, synchronize]
jobs:
build-push:
if: github.event.pull_request.draft == false
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python_version: ["3.7", "3.8", "3.9"]
steps:
- name: Checkout
uses: actions/checkout@v2
# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: ${{ github.repository_owner == 'Borda' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Publish to Docker Hub
uses: docker/build-push-action@v2
# https://github.com/docker/build-push-action#cache-to-registry
with:
build-args: |
PYTHON_VERSION=${{ matrix.python_version }}
cache-from: type=registry,ref=borda/birl:SOTA-py${{ matrix.python_version }}
cache-to: type=inline
file: bm_experiments/Dockerfile
push: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
tags: borda/birl:SOTA-py${{ matrix.python_version }}
timeout-minutes: 240