-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
45 lines (34 loc) · 1.47 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
# build go-jsonnet
FROM golang:alpine as go_builder
RUN apk add git
RUN go get github.com/fatih/color
RUN wget https://github.com/google/go-jsonnet/archive/v0.15.0.zip && \
unzip v0.15.0.zip && mkdir -p /go/src/github.com/google/go-jsonnet && \
mv go-jsonnet-0.15.0/* /go/src/github.com/google/go-jsonnet/ && \
cd /go/src/github.com/google/go-jsonnet/cmd/jsonnet && CGO_ENABLED=0 go build
# build base c jsonnet
FROM alpine:latest as c_builder
RUN apk -U add build-base
WORKDIR /opt
RUN wget https://github.com/google/jsonnet/archive/v0.15.0.zip
RUN unzip v0.15.0.zip
RUN cd jsonnet-0.15.0 && \
make -j && \
mv jsonnet /usr/local/bin && \
mv jsonnetfmt /usr/local/bin && \
rm -rf /opt/jsonnet-0.15.0 && ls /usr/local/bin/jsonnet
FROM rust:alpine as rust_builder
RUN apk add --no-cache musl-dev git
RUN git clone https://github.com/CertainLach/jrsonnet
RUN cd jrsonnet && git checkout b6223e51616576686321bfcd3223eb93d86cee5f # 0.4.2
RUN cd jrsonnet/cmds/jrsonnet && \
cargo build --release && \
mv ../../target/release/jrsonnet /usr/local/bin && \
ls /usr/local/bin/jrsonnet
# create our container with all three
FROM alpine:latest
RUN apk add --no-cache libstdc++ jq
COPY --from=c_builder /usr/local/bin/jsonnet /bin/c-jsonnet
COPY --from=c_builder /usr/local/bin/jsonnetfmt /bin/jsonnetfmt
COPY --from=go_builder /go/src/github.com/google/go-jsonnet/cmd/jsonnet/jsonnet /bin/jsonnet
COPY --from=rust_builder /usr/local/bin/jrsonnet /bin/jrsonnet