-
Notifications
You must be signed in to change notification settings - Fork 70
/
Dockerfile
38 lines (27 loc) · 903 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FROM golang:1.14-alpine as builder
ENV BASE_APP_DIR=/go/src/github.com/kyma-project/examples/orders-service \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
WORKDIR ${BASE_APP_DIR}
COPY ./go.mod .
COPY ./go.sum .
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
#
# copy files allowed in .dockerignore
#
COPY . ${BASE_APP_DIR}/
RUN go build -ldflags "-s -w" -a -o main cmd/main.go \
&& mkdir /app \
&& mv ./main /app/main
# get latest CA certs
FROM alpine:latest as certs
RUN apk --update add ca-certificates
# result container
FROM alpine:latest
LABEL source = [email protected]:kyma-project/examples.git
COPY --from=builder /app /app
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
ENTRYPOINT ["/app/main"]