-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
77 lines (54 loc) · 1.86 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
FROM ubuntu:21.04 AS builder
RUN apt-get update
RUN apt-get -y install curl flex bison libssl-dev python-dev libgmp-dev build-essential
RUN curl -OL https://golang.org/dl/go1.16.7.linux-amd64.tar.gz && tar -C /usr/local -xvf go1.16.7.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
ARG sa_enabled=false
WORKDIR /build
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY / .
WORKDIR /build/libraries
RUN set -eux; \
tar -zxvf pbc.tar.gz && \
cd pbc-0.5.14 && \
./configure && \
make && \
make install
WORKDIR /build
RUN mkdir -p /build/bin \
&& go build -ldflags "-X abe/plugin.sa_enabled=$sa_enabled" -o /build/bin/abe . \
&& sha256sum -b /build/bin/abe > /build/bin/SHA256SUMS
# VAULT
FROM vault:1.8.0
ARG always_upgrade
RUN echo ${always_upgrade} >/dev/null && apk update && apk upgrade
RUN apk add bash openssl jq
RUN set -eux; \
apk add --no-cache musl build-base flex bison gmp-dev
WORKDIR /tmp/libraries
COPY --from=builder /build/libraries .
RUN set -eux; \
tar -zxvf pbc.tar.gz && \
cd pbc-0.5.14 && \
./configure && \
make && \
make install
WORKDIR /
RUN export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc
ENV GLIBC_VERSION=2.32-r0
RUN set -ex && \
apk --update add libstdc++ curl ca-certificates && \
for pkg in glibc-${GLIBC_VERSION} glibc-bin-${GLIBC_VERSION}; \
do curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/${pkg}.apk -o /tmp/${pkg}.apk; done && \
apk add --allow-untrusted /tmp/*.apk && \
rm -v /tmp/*.apk && \
/usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib
USER vault
WORKDIR /vault
RUN chown -R vault:vault .
COPY --from=builder /build/bin/abe /vault/plugins/abe
COPY --from=builder /build/bin/SHA256SUMS /vault/plugins/SHA256SUMS