Skip to content

[testing] docker workflows #4

[testing] docker workflows

[testing] docker workflows #4

name: Build Docker Container
on:
pull_request:
types: [opened, synchronize]
branches:
- main
push:
branches:
- 'main'
schedule:
- cron: '0 0 * * *'
env:
DEV: startsWith(github.head_ref, 'main')
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: debug
run: |
echo $DEV
- 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.ref_name }}
- 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 }}