forked from openpitrix/openpitrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
21 lines (15 loc) · 799 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright 2017 The OpenPitrix Authors. All rights reserved.
# Use of this source code is governed by a Apache license
# that can be found in the LICENSE file.
FROM openpitrix/openpitrix-builder as builder
WORKDIR /go/src/openpitrix.io/openpitrix/
COPY . .
RUN mkdir -p /openpitrix_bin
RUN go generate openpitrix.io/openpitrix/pkg/version && \
CGO_ENABLED=0 GOOS=linux GOBIN=/openpitrix_bin go install -ldflags '-w -s' -tags netgo openpitrix.io/openpitrix/cmd/... && \
CGO_ENABLED=0 GOOS=linux GOBIN=/openpitrix_bin go install -ldflags '-w -s' -tags netgo openpitrix.io/openpitrix/metadata/cmd/...
RUN find /openpitrix_bin -type f -exec upx {} \;
FROM alpine:3.7
RUN apk add --update ca-certificates && update-ca-certificates
COPY --from=builder /openpitrix_bin/* /usr/local/bin/
CMD ["sh"]