Skip to content

Commit

Permalink
Custom arm64 docker builder
Browse files Browse the repository at this point in the history
  • Loading branch information
caipira113 committed Mar 20, 2024
1 parent fca4dd1 commit ba4cb6b
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,50 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Get commit sha
run: echo "COMMIT_SHA=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v1
uses: google-github-actions/auth@v2
with:
token_format: access_token
workload_identity_provider: ${{ secrets.IDENTITY_PROVIDER }}
service_account: ${{ secrets.SERVICE_ACCOUNT }}
- name: Login to Artifact Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ secrets.ARTIFACT_REGISTRY }}
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Add SSH key
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
ssh-keyscan -p ${{ secrets.ARM_NODE_PORT }} -H ${{ secrets.ARM_NODE_ADDR }} >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
echo "${{ secrets.SSH_PRIVATE_KEY }}" | ssh-add -
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
with:
platforms: linux/amd64,linux/arm64
endpoint: unix:///var/run/docker.sock
platforms: linux/amd64
append: |
- endpoint: ssh://${{ secrets.ARM_NODE_USER }}@${{ secrets.ARM_NODE_ADDR }}:${{ secrets.ARM_NODE_PORT }}
platforms: linux/arm64
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ secrets.ARTIFACT_REGISTRY }}/libnare/${{ github.event.repository.name }}/${{ github.ref_name }}
- name: Build and Push
env:
IMAGE_TAG: ${{ github.sha }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down

0 comments on commit ba4cb6b

Please sign in to comment.