Skip to content

[testing] docker workflows #24

[testing] docker workflows

[testing] docker workflows #24

name: Build Docker Container
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
push:
branches:
- 'main'
schedule:
- cron: '0 0 * * *'
env:
DEV: ${{ github.base_ref == 'main' && github.event_name == 'pull_request'}}
NAME: ${{ github.event.number }}
permissions:
contents: read
packages: write
jobs:
build-container:
name: Build sparseml container
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Dev Docker Container
if: ${{ env.DEV == 'true' }}
uses: docker/build-push-action@v4
with:
context: ./docker_dev
build-args: |
BRANCH=${{github.head_ref}}
- name: Build Nightly Docker Container
if: ${{ env.DEV == 'false' }}
uses: docker/build-push-action@v4
with:
context: ./docker_nightly
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/neuralmagic/test-sparseml-nightly:latest, ghcr.io/neuralmagic/test-sparseml-nightly:${{ steps.date.outputs.date }}