Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyanesh Mishra authored and Gyanesh Mishra committed Dec 1, 2023
1 parent e3fc738 commit ed3ef77
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 1 deletion.
92 changes: 92 additions & 0 deletions .github/workflows/build-soci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Build and push docker image with soci indexes to ghcr

on:
workflow_dispatch:
push:
branches:
- 'INFRA-2132-soci'

jobs:
build-and-push-image:
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
runs-on: a100-runner
permissions:
contents: write
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
swap-storage: true

- name: Install soci
uses: lerentis/[email protected]
with:
soci-release: 'v0.4.0'

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Set up containerd for ubuntu
uses: crazy-max/[email protected]

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/predibase/lorax
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=,suffix=,format=short
type=raw,value=latest
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}

- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile # Path to your Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
outputs: type=oci,dest=/tmp/lorax-${{ steps.meta.outputs.tags }}.tar

- name: Import image in containerd
run: |
sudo ctr i import --base-name ghcr.io/predibase/lorax --digests --all-platforms /tmp/lorax-${{ steps.meta.outputs.tags }}.tar
- name: Push image with containerd
run: |
sudo ctr i push --user "${{ github.repository_owner }}:${{ secrets.GHCR_PAT }}" ghcr.io/predibase/lorax:${{ steps.meta.outputs.tags }}
- name: Create and push soci index
run: |
sudo soci create ghcr.io/predibase/lorax:${{ steps.meta.outputs.tags }}
sudo soci push --user ${{ github.repository_owner }}:${{ secrets.GHCR_PAT }} ghcr.io/predibase/lorax:${{ steps.meta.outputs.tags }}
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- 'v*'
pull_request:
types: [opened, synchronize, reopened]
branches: [ master ]
branches: [ main ]
paths:
- '.github/workflows/build.yaml'

Expand Down

0 comments on commit ed3ef77

Please sign in to comment.