Skip to content

Commit

Permalink
rdma-tools: cuda (#22)
Browse files Browse the repository at this point in the history
* rdma-tools: cuda

Signed-off-by: [email protected] <[email protected]>

* rdma-tools: cuda

Signed-off-by: [email protected] <[email protected]>

* rdma-tools: cuda

Signed-off-by: [email protected] <[email protected]>

* rdma-tools: cuda

Signed-off-by: [email protected] <[email protected]>

* rdma-tools: cuda

Signed-off-by: [email protected] <[email protected]>

* rdma-tools: cuda

Signed-off-by: [email protected] <[email protected]>

* rdma-tools: cuda

Signed-off-by: [email protected] <[email protected]>

---------

Signed-off-by: [email protected] <[email protected]>
  • Loading branch information
weizhoublue authored Jul 19, 2024
1 parent 5a3f8ae commit 924ad29
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 79 deletions.
56 changes: 0 additions & 56 deletions .github/workflows/ImageLatestRdmaTools.yaml

This file was deleted.

45 changes: 44 additions & 1 deletion .github/workflows/ImageRdmaTools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ on:
description: 'sha, branch or tag for code'
required: true
default: main
baseImageCudaVersion:
description: 'cuda verison for base image'
required: false
baseImageOSVersion:
description: 'os verison for base image'
required: false

permissions: write-all

Expand All @@ -37,6 +43,8 @@ jobs:
build_platform: ${{ env.build_platform }}
upload_artifact: ${{ env.upload_artifact }}
dockerfile_dirctory: ${{ env.dockerfile_dirctory }}
baseImageFullName: ${{ env.baseImageFullName }}
image_tag: ${{ env.image_tag }}
steps:
- name: get information
run: |
Expand Down Expand Up @@ -68,6 +76,40 @@ jobs:
echo "upload_artifact=false" >> $GITHUB_ENV
fi
- name: Checkout Source Code
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ env.code_sha }}

- name: Getting Build Arg
id: arg
run: |
set -x
echo "get base image"
if [ -n "${{ github.event.inputs.baseImageCudaVersion }}" ] ; then
baseImageCudaVersion=${{ github.event.inputs.baseImageCudaVersion }}
fi
if [ -n "${{ github.event.inputs.baseImageOSVersion }}" ] ; then
baseImageOSVersion=${{ github.event.inputs.baseImageOSVersion }}
fi
if [ -n "${baseImageCudaVersion}" ] && [ -n "${baseImageOSVersion}" ] ; then
export BASEIMAGE_CUDA_VERISON=${baseImageCudaVersion}
export BASEIMAGE_OS_VERISON=${baseImageOSVersion}
fi
chmod +x ${{ env.DOCKERFILE_PATH }}/version.sh
source ${{ env.DOCKERFILE_PATH }}/version.sh
echo "baseImageFullName=${BASEIMAGE_FULL_NAME}" >> $GITHUB_ENV
echo "get image tag"
image_tag=${{ inputs.image_tag }}
if [ -n "${image_tag}" ]; then
echo "image_tag=${BASEIMAGE_CUDA_VERISON}-${{ inputs.image_tag }}" >> $GITHUB_ENV
else
image_tag=$( git ls-tree --full-tree HEAD -- ${{ env.DOCKERFILE_PATH }} | awk '{ print $3 }' )
[ -n "${image_tag}" ] || { echo "error, failed to get image_tag from commit id"; exit 1 ; }
echo "image_tag=${BASEIMAGE_CUDA_VERISON}-${image_tag}" >> $GITHUB_ENV
fi
call-workflow:
needs: [get_info]
uses: ./.github/workflows/callBuildImage.yaml
Expand All @@ -78,5 +120,6 @@ jobs:
dockerfile_dirctory: ${{ needs.get_info.outputs.dockerfile_dirctory }}
build_platform: ${{ needs.get_info.outputs.build_platform }}
upload_artifact: ${{ needs.get_info.outputs.upload_artifact }}
# leave image_tag empty , use commit id for tag
baseImageFullName: ${{ needs.get_info.outputs.baseImageFullName }}
image_tag: ${{ needs.get_info.outputs.image_tag }}
secrets: inherit
8 changes: 6 additions & 2 deletions .github/workflows/callBuildImage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ on:
code_sha:
required: true
type: string
# if empty, use the commit id of dockerfile_dirctory
image_tag:
required: false
required: true
type: string
push_image:
required: true
Expand All @@ -31,6 +30,9 @@ on:
upload_artifact:
required: true
type: string
baseImageFullName:
required: true
type: string
outputs:
imageArtifactName:
description: "image Artifact Name"
Expand Down Expand Up @@ -70,6 +72,7 @@ jobs:
echo "dockerfile_dirctory=${{ inputs.dockerfile_dirctory }}" >> $GITHUB_ENV
echo "build_platform=${{ inputs.build_platform }}" >> $GITHUB_ENV
echo "upload_artifact=${{ inputs.upload_artifact }}" >> $GITHUB_ENV
echo "baseImageFullName=${{ inputs.baseImageFullName }}" >> $GITHUB_ENV
echo "upload_image_artifact_name=image-$( date +%Y%m%d%H%M%S%N )" >> $GITHUB_ENV
# spidernet-io/charts -> spidernet-io
org_name=$( awk -F'/' '{print $1}' <<< "${{ env.IMAGE_REPO }}" )
Expand Down Expand Up @@ -125,6 +128,7 @@ jobs:
GIT_COMMIT_VERSION=${{ env.commitver }}
GIT_COMMIT_TIME=${{ env.committime }}
VERSION=${{ env.code_sha }}
BASE_IMAGE=${{ env.baseImageFullName }}
# Upload artifact race images tar
- name: Upload image tar
Expand Down
2 changes: 1 addition & 1 deletion rdma-tools/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: rdma-test
image:
registry: ghcr.io
repository: spidernet-io/rdma-tools
tag: "6b6e9e33e55176ddd46d6cc19e0d8776eb3d5336"
tag: "12.5.1-2c4f5689f61cb66418a333bd1cf5a147ca6eeaa6"

pullPolicy: IfNotPresent
imagePullSecrets: []
Expand Down
35 changes: 16 additions & 19 deletions rdma-tools/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# Copyright 2024 Authors of spidernet-io
# SPDX-License-Identifier: Apache-2.0

ARG UBUNTU_IMAGE=docker.io/library/ubuntu:22.04
ARG BASE_IMAGE

#========== root image ==============
FROM ${UBUNTU_IMAGE} as rootfs
FROM ${BASE_IMAGE} as rootfs

# TARGETOS is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETOS
# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETARCH

ARG GIT_COMMIT_VERSION
ENV GIT_COMMIT_VERSION=${GIT_COMMIT_VERSION}
ARG GIT_COMMIT_TIME
ENV GIT_COMMIT_TIME=${GIT_COMMIT_TIME}
ARG VERSION
ENV VERSION=${VERSION}


COPY /install-tools.sh /install-tools.sh
COPY /test.sh /test.sh
COPY /tools /tools
Expand All @@ -24,21 +38,4 @@ RUN chmod +x /tools/* && mv /tools/* /usr/sbin && rm -rf /tools
# check binary
RUN chmod +x /test.sh && /test.sh && rm -f /test.sh

#============
FROM scratch
LABEL maintainer="maintainer@spidernet-io"

# TARGETOS is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETOS
# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETARCH

ARG GIT_COMMIT_VERSION
ENV GIT_COMMIT_VERSION=${GIT_COMMIT_VERSION}
ARG GIT_COMMIT_TIME
ENV GIT_COMMIT_TIME=${GIT_COMMIT_TIME}
ARG VERSION
ENV VERSION=${VERSION}

COPY --from=rootfs / /
CMD ["/usr/bin/sleep","infinity"]
12 changes: 12 additions & 0 deletions rdma-tools/image/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# for base image tag

export BASEIMAGE_CUDA_VERISON=${BASEIMAGE_CUDA_VERISON:-"12.5.1"}

export BASEIMAGE_OS_VERISON=${BASEIMAGE_OS_VERISON:-"ubuntu22.04"}

# https://hub.docker.com/r/nvidia/cuda
# nvidia/cuda:12.5.1-cudnn-runtime-ubuntu22.04
export BASEIMAGE_FULL_NAME=nvidia/cuda:${BASEIMAGE_CUDA_VERISON}-cudnn-runtime-${BASEIMAGE_OS_VERISON}

0 comments on commit 924ad29

Please sign in to comment.