diff --git a/.github/workflows/build-and-upload-image.yaml b/.github/workflows/build-and-upload-image.yaml new file mode 100644 index 0000000..1a70215 --- /dev/null +++ b/.github/workflows/build-and-upload-image.yaml @@ -0,0 +1,62 @@ +name: Build and upload image + +on: + workflow_call: + inputs: + actor: + required: true + type: string + + imageName: + required: true + type: string + + imageTag: + required: true + type: string + + dockerfile: + required: true + type: string + + secrets: + ghToken: + required: true + +env: + REGISTRY: ghcr.io + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ inputs.actor }} + password: ${{ secrets.ghToken }} + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + file: ${{ inputs.dockerfile }} + push: true + tags: ${{ env.REGISTRY }}/${{ inputs.imageName }}:${{ inputs.imageTag }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ inputs.imageName }}:${{ inputs.imageTag }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true + diff --git a/.github/workflows/build-device-plugin.yaml b/.github/workflows/build-device-plugin.yaml new file mode 100644 index 0000000..ffa42f3 --- /dev/null +++ b/.github/workflows/build-device-plugin.yaml @@ -0,0 +1,18 @@ +name: Build device plugin image + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + build: + name: Build image + uses: ./.github/workflows/build-and-upload-image.yaml + with: + actor: ${{ github.actor }} + dockerfile: Dockerfile.device_plugin + imageName: nvshare-device-plugin + imageTag: latest + secrets: + ghToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-libnvshare.yaml b/.github/workflows/build-libnvshare.yaml new file mode 100644 index 0000000..5c78c82 --- /dev/null +++ b/.github/workflows/build-libnvshare.yaml @@ -0,0 +1,18 @@ +name: Build libnvshare image + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + build: + name: Build image + uses: ./.github/workflows/build-and-upload-image.yaml + with: + actor: ${{ github.actor }} + dockerfile: Dockerfile.libnvshare + imageName: nvshare-libnvshare + imageTag: latest + secrets: + ghToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-scheduler.yaml b/.github/workflows/build-scheduler.yaml new file mode 100644 index 0000000..708f5dc --- /dev/null +++ b/.github/workflows/build-scheduler.yaml @@ -0,0 +1,18 @@ +name: Build scheduler image + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + build: + name: Build image + uses: ./.github/workflows/build-and-upload-image.yaml + with: + actor: ${{ github.actor }} + dockerfile: Dockerfile.scheduler + imageName: nvshare-scheduler + imageTag: latest + secrets: + ghToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 4c7aea4..28ed1a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ *~ *.o *.so -.* + nvsharectl nvshare-scheduler nvshare*.tar.gz diff --git a/Dockerfile.libnvshare b/Dockerfile.libnvshare index 2203671..85df807 100644 --- a/Dockerfile.libnvshare +++ b/Dockerfile.libnvshare @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:18.04 as build +FROM ubuntu:22.04 as build COPY ./src/ /src WORKDIR /src RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN make libnvshare.so -FROM ubuntu:18.04 +FROM ubuntu:22.04 COPY --from=build /src/libnvshare.so /libnvshare.so ENTRYPOINT ["echo", "This container is not meant to be executed"] diff --git a/Dockerfile.scheduler b/Dockerfile.scheduler index b50f3f3..ab0385d 100644 --- a/Dockerfile.scheduler +++ b/Dockerfile.scheduler @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:18.04 as build +FROM ubuntu:22.04 as build COPY ./src/ /src WORKDIR /src RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN make nvshare-scheduler nvsharectl -FROM ubuntu:18.04 +FROM ubuntu:22.04 RUN apt-get update && apt-get install -y --no-install-recommends \ pid1