-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
36 lines (28 loc) · 934 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
# stage 1, which can go as a basic go build image runtime
FROM alpine:latest AS builder
RUN apk --no-cache add make git go gcc libtool musl-dev
# Configure Go
ENV GOROOT /usr/lib/go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
COPY go.mod .
COPY go.sum .
# The next line can be removed once the profile go.mod's are merged into master
COPY profile profile
RUN go mod download
COPY . /
RUN make ; rm -rf $GOPATH/pkg/mod
# stage 2,, which can go as a basic runtime
FROM alpine:latest
RUN apk --no-cache add make git go gcc libtool musl-dev
# Configure Go for the micro runtime
ENV GOROOT /usr/lib/go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
RUN apk --no-cache add ca-certificates && \
rm -rf /var/cache/apk/* /tmp/* && \
[ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
COPY --from=builder /auth /auth
ENTRYPOINT [ "/auth" ]