-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (27 loc) · 852 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
39
40
41
############################
# STEP 1 build executable binary
############################
FROM golang:alpine AS builder
# Install git.
RUN apk update && apk add --no-cache git
RUN apk add --no-cache --upgrade bash
RUN apk add --no-cache make
RUN apk add build-base
RUN apk add -U --no-cache ca-certificates && update-ca-certificates
WORKDIR $GOPATH/src/mypacgoinventory/
RUN pwd
COPY . .
WORKDIR $GOPATH/src/mypacgoinventory/cmd/app
RUN go get -d -v
WORKDIR $GOPATH/src/mypacgoinventory/
# Build the binary.
RUN make
###########################
#STEP 2 build a small image
###########################
FROM alpine:latest
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
WORKDIR /app
COPY --from=builder /go/src/mypacgoinventory/goinventory /app/goinventory
# Run the hello binary.
ENTRYPOINT ["/app/goinventory"]