feat(build): support arm arm64 386 amd64 binary.

This commit is contained in:
Bo-Yi Wu 2017-12-09 18:10:06 +08:00
parent 0afb796085
commit ac5bf03e25
3 changed files with 46 additions and 8 deletions

View File

@ -20,7 +20,34 @@ pipeline:
- make misspell-check
- make test
- make coverage
- make static_build
build_linux_amd64:
image: appleboy/golang-testing
pull: true
group: build
commands:
- make build_linux_amd64
build_linux_i386:
image: appleboy/golang-testing
pull: true
group: build
commands:
- make build_linux_i386
build_linux_arm64:
image: appleboy/golang-testing
pull: true
group: build
commands:
- make build_linux_arm64
build_linux_arm:
image: appleboy/golang-testing
pull: true
group: build
commands:
- make build_linux_arm
codecov:
image: robertstettner/drone-codecov

View File

@ -1,7 +1,10 @@
FROM centurylink/ca-certs
FROM plugins/base:multiarch
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>"
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>" \
org.label-schema.name="Drone Telegram" \
org.label-schema.vendor="Bo-Yi Wu" \
org.label-schema.schema-version="1.0"
ADD drone-telegram /
ADD release/linux/amd64/drone-telegram /bin/
ENTRYPOINT ["/drone-telegram"]
ENTRYPOINT ["/bin/drone-telegram"]

View File

@ -120,9 +120,17 @@ release-copy:
release-check:
cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
# for docker.
static_build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $(DEPLOY_IMAGE)
build_linux_amd64:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/amd64/$(DEPLOY_IMAGE)
build_linux_i386:
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/i386/$(DEPLOY_IMAGE)
build_linux_arm64:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm64/$(DEPLOY_IMAGE)
build_linux_arm:
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm/$(DEPLOY_IMAGE)
docker_image:
docker build -t $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE) .