diff --git a/.drone.yml b/.drone.yml index efc001a..179e5df 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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 ] diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 new file mode 100644 index 0000000..73a2a10 --- /dev/null +++ b/Dockerfile.aarch64 @@ -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"] diff --git a/Dockerfile.armhf b/Dockerfile.armhf new file mode 100644 index 0000000..dcb854f --- /dev/null +++ b/Dockerfile.armhf @@ -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"] diff --git a/Makefile b/Makefile index d952f49..715a440 100644 --- a/Makefile +++ b/Makefile @@ -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 .