tests 1 #671
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Images | |
| on: | |
| release: | |
| types: [published] | |
| push: | |
| branches: | |
| - '**' | |
| env: | |
| ECR_REPOSITORY: public.ecr.aws/succinct-labs/spn-node | |
| jobs: | |
| build: | |
| if: github.event_name == 'release' || (github.event_name == 'push' && contains(github.event.head_commit.message, '[docker]')) | |
| runs-on: | |
| [ | |
| 'runs-on', | |
| 'runner=32cpu-linux-x64', | |
| 'run-id=${{ github.run_id }}', | |
| 'hdd=41', | |
| 'spot=false', | |
| 'tag=gpu', | |
| 'disk=large', | |
| ] | |
| steps: | |
| - name: Add SHORT_SHA env property with commit short sha | |
| run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV | |
| # https://github.com/orgs/community/discussions/25678 | |
| - name: Delete huge unnecessary tools folder | |
| run: | | |
| df -h | |
| sudo rm -rf /opt/hostedtoolcache | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/share/boost | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| df -h | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Setup CI | |
| uses: ./.github/actions/setup | |
| - name: Configure AWS credentials | |
| uses: 'aws-actions/configure-aws-credentials@v1' | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Set up Docker | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set up NVIDIA Container Toolkit | |
| run: | | |
| distribution=$(. /etc/os-release;echo $ID$VERSION_ID) | |
| curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - | |
| curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list | |
| sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit | |
| sudo systemctl restart docker | |
| - name: Login to Amazon ECR Public | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| registry-type: public | |
| - name: Build and Push GPU Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| target: gpu | |
| platforms: linux/amd64 | |
| push: true | |
| tags: | | |
| ${{ env.ECR_REPOSITORY }}:${{ env.SHORT_SHA }}-gpu | |
| ${{ env.ECR_REPOSITORY }}:latest-gpu | |
| ${{ github.event_name == 'release' && format('{0}:{1}-gpu', env.ECR_REPOSITORY, github.ref_name) || '' }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build and Push CPU Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| target: cpu | |
| platforms: linux/amd64 | |
| push: true | |
| tags: | | |
| ${{ env.ECR_REPOSITORY }}:${{ env.SHORT_SHA }}-cpu | |
| ${{ env.ECR_REPOSITORY }}:latest-cpu | |
| ${{ github.event_name == 'release' && format('{0}:{1}-cpu', env.ECR_REPOSITORY, github.ref_name) || '' }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |