forked from thftgr/osuFastCashedBeatmapMirror
-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (55 loc) · 1.98 KB
/
docker_build_push.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
name: Docker Image CI
on:
push:
branches:
- 'release'
env:
REGISTRY: ghcr.io
IMAGE_NAME: nerinyan-apiv2
REPOSITORY_OWNER: nerinyan
PLATFORMS: linux/amd64 #,linux/arm64
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.20.5'
- name: build
run: |
#ls -al /etc/ssl/certs/
cp /etc/ssl/certs/ca-certificates.crt .
go mod download
IFS=',' read -ra PLATFORMS <<< "${{ env.PLATFORMS }}"
CGO_ENABLED=0
for platform in "${PLATFORMS[@]}"; do
platform="${platform#"${platform%%[![:space:]]*}"}"
platform="${platform%"${platform##*[![:space:]]}"}"
GOARCH=$(echo "$platform" | cut -d '/' -f 2)
GOOS=$(echo "$platform" | cut -d '/' -f 1)
echo build start CGO_ENABLED=$CGO_ENABLED go build -a -ldflags="-s -w" -o ./app-${GOOS}-${GOARCH}
CGO_ENABLED=0 go build -a -ldflags="-s -w" -o ./app-${GOOS}-${GOARCH}
echo build end ./app-${GOOS}-${GOARCH}
#ldd ./app-${GOOS}-${GOARCH} || true
done
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
platforms: ${{ env.PLATFORMS }}
file: ./Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}:${{github.run_number}}