using multiple stage build for alpine. (#279)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
00d5d25d04
commit
064632a19e
45
.drone.yml
45
.drone.yml
|
@ -31,19 +31,19 @@ pipeline:
|
|||
- make misspell-check
|
||||
- make fmt-check
|
||||
|
||||
build:
|
||||
build_linux_amd64:
|
||||
image: appleboy/golang-testing:1.9
|
||||
group: golang
|
||||
commands:
|
||||
- make docker_build
|
||||
|
||||
arm64:
|
||||
build_linux_arm64:
|
||||
image: appleboy/golang-testing:1.9
|
||||
group: golang
|
||||
commands:
|
||||
- make docker_build_arm64
|
||||
|
||||
arm:
|
||||
build_linux_arm:
|
||||
image: appleboy/golang-testing:1.9
|
||||
group: golang
|
||||
commands:
|
||||
|
@ -63,7 +63,6 @@ pipeline:
|
|||
- .cover/coverage.txt
|
||||
when:
|
||||
event: [ push, pull_request ]
|
||||
status: [ success ]
|
||||
|
||||
release:
|
||||
image: appleboy/golang-testing:1.9
|
||||
|
@ -88,24 +87,24 @@ pipeline:
|
|||
branch: [ master ]
|
||||
local: false
|
||||
|
||||
publish_linux_armhf:
|
||||
publish_linux_arm:
|
||||
image: plugins/docker
|
||||
group: publish
|
||||
repo: ${DRONE_REPO}
|
||||
tags: [ 'linux-arm' ]
|
||||
dockerfile: Dockerfile.armhf
|
||||
tags: [ linux-arm ]
|
||||
dockerfile: Dockerfile.arm
|
||||
secrets: [ docker_username, docker_password ]
|
||||
when:
|
||||
event: [ push ]
|
||||
branch: [ master ]
|
||||
local: false
|
||||
|
||||
publish_linux_aarch64:
|
||||
publish_linux_arm64:
|
||||
image: plugins/docker
|
||||
group: publish
|
||||
repo: ${DRONE_REPO}
|
||||
tags: [ 'linux-arm64' ]
|
||||
dockerfile: Dockerfile.aarch64
|
||||
tags: [ linux-arm64 ]
|
||||
dockerfile: Dockerfile.arm64
|
||||
secrets: [ docker_username, docker_password ]
|
||||
when:
|
||||
event: [ push ]
|
||||
|
@ -124,32 +123,6 @@ 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 ]
|
||||
|
|
18
Dockerfile
18
Dockerfile
|
@ -1,8 +1,22 @@
|
|||
FROM centurylink/ca-certs
|
||||
EXPOSE 8088
|
||||
FROM alpine:3.6 as alpine
|
||||
RUN apk add -U --no-cache ca-certificates
|
||||
|
||||
FROM scratch
|
||||
MAINTAINER Bo-Yi Wi <appleboy.tw@gmail.com>
|
||||
|
||||
ENV GODEBUG=netdns=go
|
||||
|
||||
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
|
||||
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"
|
||||
|
||||
ADD config/config.yml /
|
||||
ADD bin/gorush /
|
||||
|
||||
EXPOSE 8088
|
||||
ENTRYPOINT ["/gorush"]
|
||||
CMD ["-c", "config.yml"]
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
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"]
|
|
@ -0,0 +1,22 @@
|
|||
FROM alpine:3.6 as alpine
|
||||
RUN apk add -U --no-cache ca-certificates
|
||||
|
||||
FROM scratch
|
||||
MAINTAINER Bo-Yi Wi <appleboy.tw@gmail.com>
|
||||
|
||||
ENV GODEBUG=netdns=go
|
||||
|
||||
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
|
||||
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"
|
||||
|
||||
ADD config/config.yml /
|
||||
ADD bin/gorush-arm /gorush
|
||||
|
||||
EXPOSE 8088
|
||||
ENTRYPOINT ["/gorush"]
|
||||
CMD ["-c", "config.yml"]
|
|
@ -0,0 +1,22 @@
|
|||
FROM alpine:3.6 as alpine
|
||||
RUN apk add -U --no-cache ca-certificates
|
||||
|
||||
FROM scratch
|
||||
MAINTAINER Bo-Yi Wi <appleboy.tw@gmail.com>
|
||||
|
||||
ENV GODEBUG=netdns=go
|
||||
|
||||
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
|
||||
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"
|
||||
|
||||
ADD config/config.yml /
|
||||
ADD bin/gorush-arm64 /gorush
|
||||
|
||||
EXPOSE 8088
|
||||
ENTRYPOINT ["/gorush"]
|
||||
CMD ["-c", "config.yml"]
|
|
@ -1,10 +0,0 @@
|
|||
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"]
|
1
Makefile
1
Makefile
|
@ -167,6 +167,7 @@ docker_build:
|
|||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue