This repository was archived by the owner on Jan 12, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +25
-11
lines changed Expand file tree Collapse file tree 4 files changed +25
-11
lines changed Original file line number Diff line number Diff line change 1- k-rail
2- vendor
1+ /k-rail
2+ /evicter
3+ vendor
Original file line number Diff line number Diff line change 11# Build stage
22ARG GO_VERSION=1.13
3- FROM golang:${GO_VERSION}-alpine AS builder
4- RUN mkdir build; apk --no-cache add ca-certificates git make
3+ FROM golang:${GO_VERSION}-alpine3.10 AS builder
4+ RUN mkdir build ; apk --no-cache add ca-certificates git make
55WORKDIR /go/src/github.com/cruise-automation/k-rail
66COPY ./ /build/
7- RUN cd /build; make test; make build
7+ RUN cd /build; make clean; make test; make build
88
99# Production image build stage
1010FROM scratch
1111EXPOSE 8443/tcp
1212COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
13- COPY --from=builder /etc/passwd /etc/passwd
1413COPY --from=builder /build/k-rail /k-rail
14+ COPY --from=builder /build/evicter /evicter
1515USER 65534
1616ENTRYPOINT ["/k-rail" , "-config" , "/config/config.yml" ]
Original file line number Diff line number Diff line change 99# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010# See the License for the specific language governing permissions and
1111# limitations under the License.
12+ .PHONY : all build test image clean
1213
13- ensure :
14- dep ensure
14+ LDFLAGS = -extldflags=-static -s -w
15+ BUILD_FLAGS = -mod=readonly -ldflags '$(LDFLAGS ) ' -trimpath
16+ BUILD_VERSION ?= manual
17+ IMAGE_NAME = "cruise/k-rail:${BUILD_VERSION}"
18+
19+ all : dist
20+
21+ dist : image
22+
23+ clean :
24+ rm -f evicter k-rail
1525
1626build :
17- GO111MODULE=on CGO_ENABLED=0 go build -o k-rail cmd/main.go
27+ GO111MODULE=on CGO_ENABLED=0 go build ${BUILD_FLAGS} -o k-rail cmd/k-rail/main.go
28+ GO111MODULE=on CGO_ENABLED=0 go build ${BUILD_FLAGS} -o evicter cmd/evicter/* .go
1829
1930test :
20- GO111MODULE=on CGO_ENABLED=1 go test -race -cover $(shell go list ./... | grep -v /vendor/)
21-
31+ GO111MODULE=on CGO_ENABLED=1 go test -mod=readonly -race ./...
32+
33+ image :
34+ docker build --pull -t $(IMAGE_NAME ) .
File renamed without changes.
You can’t perform that action at this time.
0 commit comments