Skip to content

build: Move build arg (#299) #15

build: Move build arg (#299)

build: Move build arg (#299) #15

Workflow file for this run

# Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "CICD NeMo Aligner"
on:
pull_request:
branches:
- 'main'
- 'r**'
types: [ labeled ]
push:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: self-hosted-builder
if: ${{ github.event.label.name == 'Run CICD' || github.ref == 'refs/heads/main' }}
steps:
- name: Clean runner cache
run: |
docker system prune --filter "until=24h" --force
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.run_id }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# We use `docker` driver as this speeds things up for
# trivial (non-multi-stage) builds.
driver: docker
- name: Pull cache images
run: |
docker pull nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number || 'buildcache' }} || true
docker pull nemoci.azurecr.io/nemo_aligner_container:buildcache || true
- name: Build and push
uses: docker/build-push-action@v5
with:
file: Dockerfile
push: true
build-args: |
MAX_JOBS=32
ALIGNER_COMMIT=${{ github.event.pull_request.head.sha || github.sha }}
cache-from: |
nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number || 'buildcache' }}
nemoci.azurecr.io/nemo_aligner_container:buildcache
cache-to: type=inline
tags: nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }}
- name: Update PR image
if: github.event_name == 'pull_request'
run: |
docker tag nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number }}
docker push nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number }}
- name: Update buildcache image
if: github.ref == 'refs/heads/main'
run: |
docker tag nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} nemoci.azurecr.io/nemo_aligner_container:buildcache
docker push nemoci.azurecr.io/nemo_aligner_container:buildcache