add gcr push #2
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: Docker Image Release | |
| on: | |
| push: | |
| branches: ["main"] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push multi-arch Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: defangio/railpack-builder:latest | |
| # - name: Install ECR helper | |
| # run: | | |
| # sudo apt-get update | |
| # sudo apt-get install -y amazon-ecr-credential-helper | |
| # - name: Use ECR credential helper | |
| # run: | | |
| # mkdir -p /root/.docker | |
| # echo '{"credsStore": "ecr-login"}' > /root/.docker/config.json | |
| # - name: Configure AWS Credentials for CI | |
| # uses: aws-actions/configure-aws-credentials@v4 | |
| # with: | |
| # aws-region: us-west-2 | |
| # role-to-assume: arn:aws:iam::488659951590:role/ci-role-d4fe904 # ciRoleArn from defang-io/infrastructure stack | |
| # - name: Push image to public ECR gallery | |
| # run: | | |
| # docker tag railpack-builder:latest 488659951590.dkr.ecr.us-west-2.amazonaws.com/railpack-builder:latest | |
| # docker push 488659951590.dkr.ecr.us-west-2.amazonaws.com/railpack-builder:latest | |
| - name: Authenticate to GCR | |
| run: | | |
| gcloud auth --project=${GCP_PROJECT} configure-docker ${GCP_REGION}-docker.pkg.dev --quiet | |
| - name: Configure GCP Credentials for Shared Services | |
| uses: "google-github-actions/auth@v2" | |
| with: | |
| project_id: "defang-io" | |
| workload_identity_provider: "projects/806289336876/locations/global/workloadIdentityPools/github-actions/providers/github-actions-provider" | |
| - name: Push image to public GCR | |
| run: | | |
| docker tag railpack-builder:latest gcr.io/defang-io/railpack-builder:latest | |
| docker push gcr.io/defang-io/railpack-builder:latest |