-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.alpine
40 lines (25 loc) · 1020 Bytes
/
Dockerfile.alpine
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
# Build with: DOCKER_BUILDKIT=1 docker build -t opensentry/idpui:`cat ./VERSION` -f Dockerfile.alpine .
ARG GO_VERSION=1.12
ARG ALPINE_VERSION=3.10.3
FROM golang:${GO_VERSION}-alpine AS builder
ARG APP=idpui
RUN apk add --update --no-cache ca-certificates cmake make g++ openssl-dev git curl pkgconfig libcap
WORKDIR $GOPATH/src/github.com/opensentry/${APP}
COPY . .
RUN rm -f go.mod go.sum
RUN rm -f application-build*
RUN go get -d -v ./...
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /app
RUN cp -r ./views /views # /views is static data, which isnt built within the binary
RUN cp -r ./public /public # /public is static data, which isnt built within the binary
RUN setcap 'cap_net_bind_service=+ep' /app
# Create alpine runtime image
FROM alpine:${ALPINE_VERSION}
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app /app
COPY --from=builder /views /views
COPY --from=builder /public /public
USER 1000
EXPOSE 443
ENTRYPOINT ["/app"]
CMD ["--help"]