forked from qiushui123/zadig-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (33 loc) · 1.77 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
# New Makefile for multi-architecture
# WARNING:
# This makefile used docker buildx to build multi-arch image
# Please make sure you have the right version of docker.
.PHONY: all
## This Makefile should be used with zadig workflow to inject multiple build parameters.
IMAGE_REPOSITORY = koderover.tencentcloudcr.com/koderover-public
VERSION ?= $(shell date +'%Y%m%d%H%M%S')
VERSION := $(VERSION)
BUILD_TIME ?= $(shell date +%s)
BUILD_TIME := $(BUILD_TIME)
IMAGE ?= ${IMAGE_REPOSITORY}/zadig-portal:${VERSION}
prereq:
@docker buildx create --node=multiarch-frontend --use --platform=linux/amd64,linux/arm64
@sed -i 's/$${VERSION}/${VERSION}/g' config/prod.env.js
@sed -i 's/$${BUILD_TIME}/${BUILD_TIME}/g' config/prod.env.js
@sed -i 's/$${COMMIT_ID}/${zadig_portal_COMMIT_ID}/g' config/prod.env.js
@sed -i 's/$${BRANCH}/${zadig_portal_BRANCH}/g' config/prod.env.js
@sed -i 's/$${PR}/${zadig_portal_PR}/g' config/prod.env.js
@sed -i 's/$${TAG}/${zadig_portal_TAG}/g' config/prod.env.js
@sed -i 's/$${VERSION}/${VERSION}/g' static/version.json
@sed -i 's/$${BUILD_TIME}/${BUILD_TIME}/g' static/version.json
@sed -i 's/$${COMMIT_ID}/${zadig_portal_COMMIT_ID}/g' static/version.json
@sed -i 's/$${BRANCH}/${zadig_portal_BRANCH}/g' static/version.json
@sed -i 's/$${PR}/${zadig_portal_PR}/g' static/version.json
@sed -i 's/$${TAG}/${zadig_portal_TAG}/g' static/version.json
@cat config/prod.env.js
@cat static/version.json
all: prereq
all:
@yarn install
@yarn run build
@docker buildx build -t ${IMAGE} --platform linux/amd64,linux/arm64 -f Dockerfile --build-arg BRANCH=${zadig_portal_BRANCH} --build-arg PR=${zadig_portal_PR} --build-arg TAG=${zadig_portal_TAG} --build-arg COMMIT_ID=${zadig_portal_COMMIT_ID} --build-arg BUILD_TIME=${BUILD_TIME} --build-arg BUILD_URL=${BUILD_URL} --push .