-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
44 lines (29 loc) · 1.22 KB
/
Dockerfile.alpine
File metadata and controls
44 lines (29 loc) · 1.22 KB
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
42
43
44
# Build with: DOCKER_BUILDKIT=1 docker build -t opensentry/idp:`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=idp
RUN apk add --update --no-cache ca-certificates cmake make g++ git curl pkgconfig libcap openssl-libs-static openssl-dev
RUN update-ca-certificates 2>/dev/null || true
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 curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /app
RUN cp -r ./model /model # /views is static data, which isnt built within the binary
RUN cp -r ./emails /emails # default email templates, mount others to change
RUN cp -r ./ban /ban # default ban lists (empty), mount others to change
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 /model /model
COPY --from=builder /emails /emails
COPY --from=builder /ban /ban
USER 1000
EXPOSE 443
ENTRYPOINT ["/app"]
CMD ["--help"]