-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
62 lines (42 loc) · 1.86 KB
/
Makefile
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
.PHONY: build build/amd64 build/arm64 build/arm
APPNAME ?= pi-wifi
DOCKER_IMAGE ?= opny/${APPNAME}
BUILD_PATH ?= ./build
build: build/amd64 build/arm64 build/arm
build/amd64:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ${BUILD_PATH}/amd64 .
build/arm64:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ${BUILD_PATH}/arm64 .
build/arm:
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o ${BUILD_PATH}/arm7 .
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o ${BUILD_PATH}/arm6 .
docker/build: build docker/build/amd64 docker/build/arm64 docker/build/arm
docker/build/manifest:
docker manifest push --purge ${DOCKER_IMAGE} || true
docker manifest create \
${DOCKER_IMAGE} \
--amend ${DOCKER_IMAGE}-amd64 \
--amend ${DOCKER_IMAGE}-arm64 \
--amend ${DOCKER_IMAGE}-arm6 \
--amend ${DOCKER_IMAGE}-arm7
docker manifest annotate ${DOCKER_IMAGE} ${DOCKER_IMAGE}-amd64 --arch amd64 --os linux
docker manifest annotate ${DOCKER_IMAGE} ${DOCKER_IMAGE}-arm64 --arch arm64 --os linux
docker manifest annotate ${DOCKER_IMAGE} ${DOCKER_IMAGE}-arm6 --arch arm --variant v6 --os linux
docker manifest annotate ${DOCKER_IMAGE} ${DOCKER_IMAGE}-arm7 --arch arm --variant v7 --os linux
docker manifest push ${DOCKER_IMAGE}
docker/build/amd64:
docker build . -t ${DOCKER_IMAGE}-amd64 --build-arg ARCH=amd64
docker/build/arm64:
docker build . -t ${DOCKER_IMAGE}-arm64 --build-arg ARCH=arm64
docker/build/arm:
docker build . -t ${DOCKER_IMAGE}-arm6 --build-arg ARCH=arm7
docker build . -t ${DOCKER_IMAGE}-arm7 --build-arg ARCH=arm6
docker/push: docker/build docker/push/amd64 docker/push/arm64 docker/push/arm docker/build/manifest
docker manifest push ${DOCKER_IMAGE}
docker/push/amd64:
docker push ${DOCKER_IMAGE}-amd64
docker/push/arm64:
docker push ${DOCKER_IMAGE}-arm64
docker/push/arm:
docker push ${DOCKER_IMAGE}-arm6
docker push ${DOCKER_IMAGE}-arm7