-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
68 lines (47 loc) · 1.78 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
63
64
65
66
67
APP_NAME=was
BUILD_DIR=./build/
DOCKER_DIR=./docker/
PATH_RESOLVE=MSYS2_ARG_CONV_EXCL='*'
DOCKER_RUN=docker run --rm -v .:/src/app -w /src/app
DOCKER_IMAGE=golang:latest
# linux
build-linux-amd64:
GOOS=linux GOARCH=amd64 go build -buildvcs=false -o ${BUILD_DIR}${APP_NAME}-linux-amd64
build-linux-arm64:
GOOS=linux GOARCH=arm64 go build -o ${BUILD_DIR}${APP_NAME}-linux-arm64
# build-linux-riscv64:
# GOOS=linux GOARCH=riscv64 go build -o ${BUILD_DIR}${APP_NAME}-linux-riscv64
# window
# build-windows-386:
# GOOS=windows GOARCH=386 go build -o ${BUILD_DIR}${APP_NAME}-windows-386.exe
build-windows-amd64:
GOOS=windows GOARCH=amd64 go build -o ${BUILD_DIR}${APP_NAME}-windows-amd64.exe
# build-windows-arm64:
# GOOS=windows GOARCH=arm64 go build -o ${BUILD_DIR}${APP_NAME}-windows-arm64.exe
# build all
build-all: build-linux-amd64 build-linux-arm64 build-windows-amd64
# default build
build: build-linux-amd64
# build in docker
# linux
docker-build-linux-amd64:
${DOCKER_RUN} ${DOCKER_IMAGE} make build-linux-amd64
docker-build-linux-arm64:
${DOCKER_RUN} ${DOCKER_IMAGE} make build-linux-arm64
# window
docker-build-windows-amd64:
${DOCKER_RUN} ${DOCKER_IMAGE} make build-widnows-amd64
# docker-build-windows-arm64:
# ${DOCKER_RUN} ${DOCKER_IMAGE} make build-widnows-arm64
# docker build all
docker-build-all: docker-build-linux-amd64 docker-build-linux-arm64 docker-build-windows-amd64
# default
docker-build: docker-build-linux-amd64
# build docker image
docker-image-linux-amd64:
cp ${BUILD_DIR}${APP_NAME}-linux-amd64 ${DOCKER_DIR}
docker build --tag ${APP_NAME} -f ${DOCKER_DIR}Dockerfile .
docker-image-linux-arm64:
cp ${BUILD_DIR}${APP_NAME}-linux-arm64 ${DOCKER_DIR}
docker build --tag arm64/${APP_NAME} -f ${DOCKER_DIR}Dockerfile.arm64
docker-image: docker-image-linux-amd64