-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
45 lines (33 loc) · 1.14 KB
/
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
42
43
44
45
############################
# STEP 1 build executable plugin binary
############################
FROM golang:1.16-buster AS builder
ARG TARGETOS
ARG TARGETARCH
RUN apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates upx-ucl
WORKDIR /plugin
ENV GO111MODULE=on
COPY go.mod go.sum ./
COPY LICENSE ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w" -a -v -o quorum-hashicorp-vault-plugin
RUN upx quorum-hashicorp-vault-plugin
RUN sha256sum -b quorum-hashicorp-vault-plugin | cut -d' ' -f1 > SHA256SUM
############################
# STEP 2 build new vault image
############################
FROM library/vault:1.8.4
RUN apk add --no-cache \
jq \
curl
# Expose the plugin directory as a volume
VOLUME /vault/plugins
COPY --from=builder /plugin/LICENSE /
COPY --from=builder /plugin/quorum-hashicorp-vault-plugin /vault/plugins/quorum-hashicorp-vault-plugin
COPY --from=builder /plugin/SHA256SUM /vault/plugins/SHA256SUM
COPY --from=builder /plugin/scripts/* /usr/local/bin/
RUN setcap cap_ipc_lock=+ep /vault/plugins/quorum-hashicorp-vault-plugin
EXPOSE 8200