|
12 | 12 | - '**/*.py'
|
13 | 13 |
|
14 | 14 | jobs:
|
15 |
| - build_and_push: |
| 15 | + build_amd64: |
16 | 16 | runs-on: ubuntu-latest
|
17 |
| - |
18 | 17 | env:
|
19 | 18 | DOCKERHUB_USERNAME: rikasai
|
20 | 19 | DOCKER_REPOSITORY_NAME: fast-runner-frontend
|
| 20 | + ARCH: amd64 |
21 | 21 |
|
22 | 22 | steps:
|
23 | 23 | - name: Check out the repository
|
24 | 24 | uses: actions/checkout@v4
|
25 | 25 |
|
26 |
| - # Cache yarn dependencies |
27 | 26 | - name: Cache yarn dependencies
|
28 | 27 | uses: actions/cache@v2
|
29 | 28 | with:
|
|
32 | 31 | restore-keys: |
|
33 | 32 | ${{ runner.os }}-yarn-
|
34 | 33 |
|
35 |
| - # - name: Set up QEMU |
36 |
| - # uses: docker/setup-qemu-action@v3 |
37 |
| - |
38 |
| - # - name: Set up Docker Buildx |
39 |
| - # uses: docker/setup-buildx-action@v3 |
| 34 | + - name: Set up Docker Buildx |
| 35 | + uses: docker/setup-buildx-action@v1 |
40 | 36 |
|
41 | 37 | - name: Log in to Docker Hub
|
42 | 38 | uses: docker/login-action@v2
|
|
50 | 46 | GIT_TAG=$(git describe --tags --exact-match ${{ github.sha }} 2> /dev/null || echo "")
|
51 | 47 | echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
|
52 | 48 |
|
53 |
| - - name: Build and push Docker image |
| 49 | + - name: Build and push AMD64 Docker image |
54 | 50 | uses: docker/build-push-action@v2
|
55 | 51 | with:
|
56 | 52 | context: ./web
|
|
59 | 55 | push: true
|
60 | 56 | tags: |
|
61 | 57 | ${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest
|
| 58 | + ${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest-amd64 |
| 59 | + ${{ env.GIT_TAG != '' && format('{0}/{1}:{2}', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }} |
| 60 | + ${{ env.GIT_TAG != '' && format('{0}/{1}:{2}-amd64', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }} |
| 61 | +
|
| 62 | + build_arm64: |
| 63 | + runs-on: ubuntu-22.04-arm |
| 64 | + env: |
| 65 | + DOCKERHUB_USERNAME: rikasai |
| 66 | + DOCKER_REPOSITORY_NAME: fast-runner-frontend |
| 67 | + ARCH: arm64 |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Check out the repository |
| 71 | + uses: actions/checkout@v4 |
| 72 | + |
| 73 | + - name: Cache yarn dependencies |
| 74 | + uses: actions/cache@v2 |
| 75 | + with: |
| 76 | + path: ./web/node_modules |
| 77 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 78 | + restore-keys: | |
| 79 | + ${{ runner.os }}-yarn- |
| 80 | + |
| 81 | + - name: Set up Docker Buildx |
| 82 | + uses: docker/setup-buildx-action@v1 |
| 83 | + |
| 84 | + - name: Log in to Docker Hub |
| 85 | + uses: docker/login-action@v2 |
| 86 | + with: |
| 87 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 88 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 89 | + |
| 90 | + - name: Get Git tag if exists |
| 91 | + id: get_tag |
| 92 | + run: | |
| 93 | + GIT_TAG=$(git describe --tags --exact-match ${{ github.sha }} 2> /dev/null || echo "") |
| 94 | + echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV |
| 95 | +
|
| 96 | + - name: Build and push ARM64 Docker image |
| 97 | + uses: docker/build-push-action@v2 |
| 98 | + with: |
| 99 | + context: ./web |
| 100 | + file: ./web/Dockerfile-build |
| 101 | + platforms: linux/arm64 |
| 102 | + push: true |
| 103 | + tags: | |
| 104 | + ${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest |
| 105 | + ${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest-arm64 |
62 | 106 | ${{ env.GIT_TAG != '' && format('{0}/{1}:{2}', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
|
| 107 | + ${{ env.GIT_TAG != '' && format('{0}/{1}:{2}-arm64', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }} |
0 commit comments