support arm64 and arm docker image. (#277)

* support arm64 and arm docker image.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix format.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-08-25 00:51:04 -05:00 committed by GitHub
parent 35e2c97f43
commit a466827822
4 changed files with 91 additions and 4 deletions

View File

@ -37,6 +37,18 @@ pipeline:
commands:
- make docker_build
arm64:
image: appleboy/golang-testing
group: golang
commands:
- make docker_build_arm64
arm:
image: appleboy/golang-testing
group: golang
commands:
- make docker_build_arm
coverage:
image: appleboy/golang-testing
group: golang
@ -65,9 +77,9 @@ pipeline:
event: [ tag ]
branch: [ refs/tags/* ]
publish_latest:
publish_linux_amd64:
image: plugins/docker
pull: true
group: publish
repo: ${DRONE_REPO}
tags: [ 'latest' ]
secrets: [ docker_username, docker_password ]
@ -76,9 +88,33 @@ pipeline:
branch: [ master ]
local: false
publish_tag:
publish_linux_armhf:
image: plugins/docker
pull: true
group: publish
repo: ${DRONE_REPO}
tags: [ 'linux-arm' ]
dockerfile: Dockerfile.armhf
secrets: [ docker_username, docker_password ]
when:
event: [ push ]
branch: [ master ]
local: false
publish_linux_aarch64:
image: plugins/docker
group: publish
repo: ${DRONE_REPO}
tags: [ 'linux-arm64' ]
dockerfile: Dockerfile.aarch64
secrets: [ docker_username, docker_password ]
when:
event: [ push ]
branch: [ master ]
local: false
publish_tag_linux_amd64:
image: plugins/docker
group: tag
repo: ${DRONE_REPO}
tags: [ '${DRONE_TAG}' ]
secrets: [ docker_username, docker_password ]
@ -88,6 +124,32 @@ pipeline:
branch: [ refs/tags/* ]
local: false
publish_tag_linux_armhf:
image: plugins/docker
group: tag
repo: ${DRONE_REPO}
tags: [ '${DRONE_TAG}-linux-arm' ]
dockerfile: Dockerfile.armhf
secrets: [ docker_username, docker_password ]
group: release
when:
event: [ tag ]
branch: [ refs/tags/* ]
local: false
publish_tag_linux_aarch64:
image: plugins/docker
group: tag
repo: ${DRONE_REPO}
tags: [ '${DRONE_TAG}-linux-arm64' ]
dockerfile: Dockerfile.aarch64
secrets: [ docker_username, docker_password ]
group: release
when:
event: [ tag ]
branch: [ refs/tags/* ]
local: false
release_tag:
image: plugins/github-release
secrets: [ github_release_api_key ]

10
Dockerfile.aarch64 Normal file
View File

@ -0,0 +1,10 @@
FROM centurylink/ca-certs
ENV GODEBUG=netdns=go
EXPOSE 8088
ADD config/config.yml /
ADD bin/gorush-arm64 /gorush
ENTRYPOINT ["/gorush"]
CMD ["-c", "config.yml"]

10
Dockerfile.armhf Normal file
View File

@ -0,0 +1,10 @@
FROM centurylink/ca-certs
ENV GODEBUG=netdns=go
EXPOSE 8088
ADD config/config.yml /
ADD bin/gorush-arm /gorush
ENTRYPOINT ["/gorush"]
CMD ["-c", "config.yml"]

View File

@ -165,6 +165,11 @@ release-check:
docker_build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -a -tags '$(TAGS)' -ldflags "$(EXTLDFLAGS)-s -w $(LDFLAGS)" -o bin/$(EXECUTABLE)
docker_build_arm64:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -a -tags '$(TAGS)' -ldflags "$(EXTLDFLAGS)-s -w $(LDFLAGS)" -o bin/$(EXECUTABLE)-arm64
docker_build_arm:
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GO) build -a -tags '$(TAGS)' -ldflags "$(EXTLDFLAGS)-s -w $(LDFLAGS)" -o bin/$(EXECUTABLE)-arm
docker_image:
docker build -t $(DEPLOY_ACCOUNT)/$(DEPLOY_IMAGE) -f Dockerfile .