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-06-10 23:18:08 +03:00
|
|
|
# Build and cache the dependencies first so we can cache these layers.
|
|
|
|
COPY semantic.cabal .
|
|
|
|
COPY semantic-core semantic-core
|
|
|
|
RUN cabal new-update hackage.haskell.org,HEAD
|
|
|
|
RUN cabal new-configure semantic semantic-core
|
|
|
|
RUN cabal new-build --only-dependencies
|
2019-06-05 16:58:25 +03:00
|
|
|
|
2019-06-10 23:18:08 +03:00
|
|
|
# Copy in and build the entire project
|
2019-06-07 23:32:02 +03:00
|
|
|
COPY . .
|
|
|
|
RUN cabal new-build --flags="release" semantic:exe:semantic
|
2019-06-05 15:21:09 +03:00
|
|
|
|
|
|
|
# A fake `install` target until we can get `cabal new-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"]
|