-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.alpine
More file actions
48 lines (31 loc) · 1.28 KB
/
Dockerfile.alpine
File metadata and controls
48 lines (31 loc) · 1.28 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
45
46
47
48
# Build with: DOCKER_BUILDKIT=1 docker build -t opensentry/idp:`cat ./VERSION` -f Dockerfile.alpine .
ARG GO_VERSION=1.14
ARG ALPINE_VERSION=3.10.3
FROM golang:${GO_VERSION}-alpine AS builder
ARG APP=idp
ARG SEABOLT_VERSION="v1.7.4"
RUN apk add --update --no-cache ca-certificates cmake make g++ openssl-dev git curl pkgconfig libcap
RUN update-ca-certificates 2>/dev/null || true
WORKDIR /seabolt/build
RUN cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_LIBDIR=lib .. && cmake --build . --target install
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 ./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"]