2019-07-15 20:18:09 +03:00
|
|
|
# Put protoc and twirp tooling in its own image
|
2019-10-01 01:26:45 +03:00
|
|
|
FROM haskell:8.6 as haskell
|
2019-10-10 23:35:00 +03:00
|
|
|
RUN cabal v2-update && \
|
|
|
|
cabal v2-install proto-lens-protoc
|
2019-10-01 01:26:45 +03:00
|
|
|
RUN which proto-lens-protoc
|
|
|
|
|
|
|
|
FROM golang:1.13-stretch AS protoc
|
2019-07-06 01:11:33 +03:00
|
|
|
RUN apt-get update && apt-get install -y unzip
|
|
|
|
ENV PROTOBUF_VERSION=3.7.1
|
|
|
|
RUN wget "https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protoc-$PROTOBUF_VERSION-linux-x86_64.zip" && \
|
|
|
|
unzip "protoc-$PROTOBUF_VERSION-linux-x86_64.zip" -d "/protobuf"
|
|
|
|
|
|
|
|
RUN go get github.com/golang/protobuf/proto && \
|
|
|
|
go get github.com/twitchtv/protogen/typemap && \
|
2019-10-03 18:41:30 +03:00
|
|
|
GO111MODULE=on go get github.com/tclem/proto-lens-jsonpb/protoc-gen-jsonpb_haskell@e4d10b77f57ee25beb759a33e63e2061420d3dc2
|
2019-10-01 01:26:45 +03:00
|
|
|
|
|
|
|
COPY --from=haskell /root/.cabal/bin/proto-lens-protoc /usr/local/bin/proto-lens-protoc
|
2019-07-06 01:11:33 +03:00
|
|
|
|
2019-10-01 01:26:45 +03:00
|
|
|
ENTRYPOINT ["/protobuf/bin/protoc", "-I/protobuf", "--plugin=protoc-gen-haskell=/usr/local/bin/proto-lens-protoc"]
|
2019-07-06 01:11:33 +03:00
|
|
|
|
|
|
|
# Build semantic
|
2019-06-05 15:21:09 +03:00
|
|
|
FROM haskell:8.6 as build
|
|
|
|
WORKDIR /build
|
2019-06-05 16:58:25 +03:00
|
|
|
|
2019-10-10 23:35:00 +03:00
|
|
|
# Build just the dependencies so that this layer can be cached
|
2019-06-10 23:18:08 +03:00
|
|
|
COPY semantic.cabal .
|
2019-10-10 23:35:00 +03:00
|
|
|
COPY semantic-core semantic-core/
|
|
|
|
COPY semantic-java semantic-java/
|
|
|
|
COPY semantic-json semantic-json/
|
|
|
|
COPY semantic-python semantic-python/
|
|
|
|
COPY semantic-source semantic-source/
|
|
|
|
COPY semantic-tags semantic-tags/
|
|
|
|
COPY cabal.project .
|
|
|
|
RUN cabal v2-update && \
|
|
|
|
cabal v2-build --flags="release" --only-dependencies
|
|
|
|
|
|
|
|
# Build all of semantic
|
2019-06-07 23:32:02 +03:00
|
|
|
COPY . .
|
2019-10-10 23:35:00 +03:00
|
|
|
RUN cabal v2-build --flags="release" semantic:exe:semantic
|
2019-06-05 15:21:09 +03:00
|
|
|
|
2019-10-10 23:35:00 +03:00
|
|
|
# A fake `install` target until we can get `cabal v2-install` to work
|
2019-06-07 23:32:02 +03:00
|
|
|
RUN cp $(find dist-newstyle/build/x86_64-linux -name semantic -type f -perm -u=x) /usr/local/bin/semantic
|
2019-06-05 15:21:09 +03:00
|
|
|
|
2019-06-05 16:58:25 +03:00
|
|
|
# Create a fresh image containing only the compiled CLI program, so that the
|
|
|
|
# image isn't bulked up by all of the extra build state.
|
2019-06-05 20:22:45 +03:00
|
|
|
FROM debian:stretch-slim
|
|
|
|
|
2019-06-05 15:21:09 +03:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y \
|
|
|
|
libgmp10 \
|
|
|
|
&& \
|
|
|
|
apt-get autoremove -y && \
|
|
|
|
apt-get clean -y && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
2019-06-05 20:22:45 +03:00
|
|
|
|
2019-06-05 16:58:25 +03:00
|
|
|
COPY --from=build /usr/local/bin/semantic /usr/local/bin/semantic
|
2019-06-05 20:22:45 +03:00
|
|
|
|
2019-06-05 15:21:09 +03:00
|
|
|
ENTRYPOINT ["/usr/local/bin/semantic"]
|