feat: grind on device for 5090 (#249) #896
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 Docker to ECR | |
| on: [push] | |
| env: | |
| ECR_REGISTRY: public.ecr.aws | |
| ECR_REPOSITORY: succinct-labs/sp1-gpu | |
| jobs: | |
| docker-build-push: | |
| runs-on: [ | |
| "runs-on", | |
| "runner=32cpu-linux-x64", | |
| "run-id=${{ github.run_id }}", | |
| "spot=false" | |
| ] | |
| 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@v3 | |
| with: | |
| fetch-depth: 0 | |
| - 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: Login to Amazon ECR Public | |
| id: login-ecr-public | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| registry-type: public | |
| - name: Build and Push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile.server | |
| push: false | |
| load: true | |
| tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.SHORT_SHA }} | |
| cache-from: type=gha | |
| cache-to: type=gha, mode=max | |
| - name: Push Docker image to Amazon ECR Public | |
| run: | | |
| docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.SHORT_SHA }} | |
| # Check if a git tag exists for this commit | |
| GIT_TAG=$(git describe --tags --exact-match 2> /dev/null || true) | |
| if [ -n "$GIT_TAG" ]; then | |
| echo "Found git tag: $GIT_TAG" | |
| docker tag ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.SHORT_SHA }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:$GIT_TAG | |
| docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:$GIT_TAG | |
| # Tag and push as 'latest' for tagged commits | |
| echo "Tagging and pushing as latest" | |
| docker tag ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.SHORT_SHA }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest | |
| docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest | |
| else | |
| echo "No git tag found for this commit" | |
| fi |