Update Dockerfile #10
This file contains 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 aarch64 binary | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/aarch64 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: false | |
platforms: linux/aarch64 | |
load: true # Load the built image to Docker daemon | |
tags: miuitask_test:ci | |
- name: Create a container from the image | |
run: | | |
docker create --name temp_container miuitask_test:ci | |
- name: Copy the binary from the container to the host | |
run: | | |
mkdir -p ${{ github.workspace }}/dist | |
docker cp temp_container:/dist/miuitask ${{ github.workspace }}/dist/miuitask | |
- name: Upload binary as an artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: miuitask-binary | |
path: ${{ github.workspace }}/dist/miuitask |