未验证 提交 d5ea34c9 编写于 作者: R runzexia

enable gomod in Dockerfile & fix docker build bash

Signed-off-by: Nrunzexia <runzexia@yunify.com>
上级 cda4f4f0
...@@ -10,7 +10,7 @@ FROM golang:1.12 as ks-apigateway-builder ...@@ -10,7 +10,7 @@ FROM golang:1.12 as ks-apigateway-builder
COPY / /go/src/kubesphere.io/kubesphere COPY / /go/src/kubesphere.io/kubesphere
WORKDIR /go/src/kubesphere.io/kubesphere WORKDIR /go/src/kubesphere.io/kubesphere
RUN CGO_ENABLED=0 GO111MODULE=off GOOS=linux GOARCH=amd64 go build -i -ldflags '-w -s' -o ks-apigateway cmd/ks-apigateway/apiserver.go && \ RUN CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=amd64 GOFLAGS=-mod=vendor go build -i -ldflags '-w -s' -o ks-apigateway cmd/ks-apigateway/apiserver.go && \
go run tools/cmd/doc-gen/main.go --output=install/swagger-ui/api.json go run tools/cmd/doc-gen/main.go --output=install/swagger-ui/api.json
FROM alpine:3.9 FROM alpine:3.9
......
...@@ -10,7 +10,7 @@ FROM golang:1.12 as ks-apiserver-builder ...@@ -10,7 +10,7 @@ FROM golang:1.12 as ks-apiserver-builder
COPY / /go/src/kubesphere.io/kubesphere COPY / /go/src/kubesphere.io/kubesphere
WORKDIR /go/src/kubesphere.io/kubesphere WORKDIR /go/src/kubesphere.io/kubesphere
RUN CGO_ENABLED=0 GO111MODULE=off GOOS=linux GOARCH=amd64 go build -i -ldflags '-w -s' -o ks-apiserver cmd/ks-apiserver/apiserver.go RUN CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=amd64 GOFLAGS=-mod=vendor go build -i -ldflags '-w -s' -o ks-apiserver cmd/ks-apiserver/apiserver.go
FROM alpine:3.9 FROM alpine:3.9
RUN apk add --update ca-certificates && update-ca-certificates RUN apk add --update ca-certificates && update-ca-certificates
......
...@@ -10,7 +10,7 @@ FROM golang:1.12 as controller-manager-builder ...@@ -10,7 +10,7 @@ FROM golang:1.12 as controller-manager-builder
COPY / /go/src/kubesphere.io/kubesphere COPY / /go/src/kubesphere.io/kubesphere
WORKDIR /go/src/kubesphere.io/kubesphere WORKDIR /go/src/kubesphere.io/kubesphere
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build --ldflags "-extldflags -static" -o controller-manager ./cmd/controller-manager/ RUN CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=amd64 GOFLAGS=-mod=vendor go build --ldflags "-extldflags -static" -o controller-manager ./cmd/controller-manager/
FROM alpine:3.7 FROM alpine:3.7
RUN apk add --update ca-certificates && update-ca-certificates RUN apk add --update ca-certificates && update-ca-certificates
......
...@@ -10,7 +10,7 @@ FROM golang:1.12 as ks-iam-builder ...@@ -10,7 +10,7 @@ FROM golang:1.12 as ks-iam-builder
COPY / /go/src/kubesphere.io/kubesphere COPY / /go/src/kubesphere.io/kubesphere
WORKDIR /go/src/kubesphere.io/kubesphere WORKDIR /go/src/kubesphere.io/kubesphere
RUN CGO_ENABLED=0 GO111MODULE=off GOOS=linux GOARCH=amd64 go build -i -ldflags '-w -s' -o ks-iam cmd/ks-iam/apiserver.go RUN CGO_ENABLED=0 GO111MODULE=on GOOS=linux GOARCH=amd64 GOFLAGS=-mod=vendor go build -i -ldflags '-w -s' -o ks-iam cmd/ks-iam/apiserver.go
FROM alpine:3.9 FROM alpine:3.9
RUN apk add --update ca-certificates && update-ca-certificates RUN apk add --update ca-certificates && update-ca-certificates
......
...@@ -7,9 +7,7 @@ REPO=kubespheredev ...@@ -7,9 +7,7 @@ REPO=kubespheredev
TAG=latest TAG=latest
# check if build was triggered by a travis cronjob # check if build was triggered by a travis cronjob
if [[ ! -v TRAVIS_EVENT_TYPE ]]; then if [[ -z "$TRAVIS_EVENT_TYPE" ]]; then
echo "TRAVIS_EVENT_TYPE is not set, treat as regular build"
elif [[ -z "$TRAVIS_EVENT_TYPE" ]]; then
echo "TRAVIS_EVENT_TYPE is empty, also normaly build" echo "TRAVIS_EVENT_TYPE is empty, also normaly build"
elif [ $TRAVIS_EVENT_TYPE == "cron" ]; then elif [ $TRAVIS_EVENT_TYPE == "cron" ]; then
TAG=dev-$(date +%Y%m%d) TAG=dev-$(date +%Y%m%d)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册