feat(docker): Add i386 image. (#315)

* feat(docker): Add i386 image.

* update drone

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-12-10 19:00:15 +08:00 committed by GitHub
parent e516382af2
commit 9aedf8870e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 20 deletions

View File

@ -32,22 +32,32 @@ pipeline:
- make fmt-check
build_linux_amd64:
image: appleboy/golang-testing:1.9.2
image: appleboy/golang-testing
pull: true
group: golang
commands:
- make docker_build
- make build_linux_amd64
build_linux_i386:
image: appleboy/golang-testing
pull: true
group: golang
commands:
- make build_linux_i386
build_linux_arm64:
image: appleboy/golang-testing:1.9.2
image: appleboy/golang-testing
pull: true
group: golang
commands:
- make docker_build_arm64
- make build_linux_arm64
build_linux_arm:
image: appleboy/golang-testing:1.9.2
image: appleboy/golang-testing
pull: true
group: golang
commands:
- make docker_build_arm
- make build_linux_arm
coverage:
image: appleboy/golang-testing:1.9.2
@ -96,6 +106,19 @@ pipeline:
event: [ push, tag ]
local: false
publish_linux_i386:
image: plugins/docker
group: release
pull: true
dockerfile: Dockerfile.i386
secrets: [ docker_username, docker_password ]
default_tags: true
default_suffix: i386
repo: ${DRONE_REPO}
when:
event: [ push, tag ]
local: false
publish_linux_arm:
image: plugins/docker
group: release

View File

@ -7,7 +7,7 @@ LABEL org.label-schema.vendor="Bo-Yi Wu"
LABEL org.label-schema.schema-version="1.0"
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>"
ADD bin/gorush /
ADD release/linux/amd64/gorush /bin/
EXPOSE 8088 9000
ENTRYPOINT ["/gorush"]
ENTRYPOINT ["/bin/gorush"]

View File

@ -10,7 +10,7 @@ LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>"
RUN apk add -U --no-cache ca-certificates && \
rm -rf /var/cache/apk/*
ADD bin/gorush /
ADD release/linux/amd64/gorush /bin/
EXPOSE 8088 9000
ENTRYPOINT ["/gorush"]
ENTRYPOINT ["/bin/gorush"]

View File

@ -7,7 +7,7 @@ LABEL org.label-schema.vendor="Bo-Yi Wu"
LABEL org.label-schema.schema-version="1.0"
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>"
ADD bin/gorush-arm /gorush
ADD release/linux/arm/gorush /bin/
EXPOSE 8088 9000
ENTRYPOINT ["/gorush"]
ENTRYPOINT ["/bin/gorush"]

View File

@ -7,7 +7,7 @@ LABEL org.label-schema.vendor="Bo-Yi Wu"
LABEL org.label-schema.schema-version="1.0"
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>"
ADD bin/gorush-arm64 /gorush
ADD release/linux/arm64/gorush /bin/
EXPOSE 8088 9000
ENTRYPOINT ["/gorush"]
ENTRYPOINT ["/bin/gorush"]

13
Dockerfile.i386 Normal file
View File

@ -0,0 +1,13 @@
FROM plugins/base:multiarch
LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/appleboy/gorush.git"
LABEL org.label-schema.name="Gorush"
LABEL org.label-schema.vendor="Bo-Yi Wu"
LABEL org.label-schema.schema-version="1.0"
LABEL maintainer="Bo-Yi Wu <appleboy.tw@gmail.com>"
ADD release/linux/i386/gorush /bin/
EXPOSE 8088 9000
ENTRYPOINT ["/bin/gorush"]

View File

@ -172,14 +172,17 @@ release-copy:
release-check:
cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
docker_build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -a -tags '$(TAGS)' -ldflags "$(EXTLDFLAGS)-s -w $(LDFLAGS)" -o bin/$(EXECUTABLE)
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)
docker_build_arm64:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -a -tags '$(TAGS)' -ldflags "$(EXTLDFLAGS)-s -w $(LDFLAGS)" -o bin/$(EXECUTABLE)-arm64
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)
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
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) -f Dockerfile .