-
Notifications
You must be signed in to change notification settings - Fork 146
107 lines (92 loc) · 3.34 KB
/
upload_web_image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Build Frontend and Push Docker Image
on:
workflow_dispatch:
release:
types: [ released ]
pull_request:
branches:
- master
types: [ closed ]
paths-ignore:
- '**/*.py'
jobs:
build_amd64:
runs-on: ubuntu-latest
env:
DOCKERHUB_USERNAME: rikasai
DOCKER_REPOSITORY_NAME: fast-runner-frontend
ARCH: amd64
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Cache yarn dependencies
uses: actions/cache@v2
with:
path: ./web/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get Git tag if exists
id: get_tag
run: |
GIT_TAG=$(git describe --tags --exact-match ${{ github.sha }} 2> /dev/null || echo "")
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
- name: Build and push AMD64 Docker image
uses: docker/build-push-action@v2
with:
context: ./web
file: ./web/Dockerfile-build
platforms: linux/amd64
push: true
tags: |
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest-amd64
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}-amd64', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
build_arm64:
runs-on: ubuntu-22.04-arm
env:
DOCKERHUB_USERNAME: rikasai
DOCKER_REPOSITORY_NAME: fast-runner-frontend
ARCH: arm64
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Cache yarn dependencies
uses: actions/cache@v2
with:
path: ./web/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get Git tag if exists
id: get_tag
run: |
GIT_TAG=$(git describe --tags --exact-match ${{ github.sha }} 2> /dev/null || echo "")
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
- name: Build and push ARM64 Docker image
uses: docker/build-push-action@v2
with:
context: ./web
file: ./web/Dockerfile-build
platforms: linux/arm64
push: true
tags: |
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest-arm64
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}
${{ env.GIT_TAG != '' && format('{0}/{1}:{2}-arm64', env.DOCKERHUB_USERNAME, env.DOCKER_REPOSITORY_NAME, env.GIT_TAG) || '' }}