Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 7364e16

Browse files
authored
Merge pull request #94 from github/docker-hub
Add a Dockerfile that builds the CLI tool
2 parents f7bc9b8 + 4f94756 commit 7364e16

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM haskell:8.6 as build
2+
WORKDIR /build
3+
RUN cabal new-update
4+
5+
# Build our upstream dependencies after copying in only enough to tell cabal
6+
# what they are. This will make these layers cache better even as we change the
7+
# code of semantic itself.
8+
COPY semantic.cabal .
9+
COPY cabal.project .
10+
COPY semantic-core/semantic-core.cabal ./semantic-core/
11+
COPY vendor ./vendor
12+
RUN cabal new-build --only-dependencies
13+
14+
# Once the dependencies are built, copy in the rest of the code and compile
15+
# semantic itself.
16+
COPY . /build
17+
RUN cabal new-build semantic:exe:semantic
18+
19+
# A fake `install` target until we can get `cabal new-install` to work
20+
RUN cp $(find dist-newstyle -name semantic -type f -perm -u=x) /usr/local/bin/semantic
21+
22+
# Create a fresh image containing only the compiled CLI program, so that the
23+
# image isn't bulked up by all of the extra build state.
24+
FROM debian:stretch-slim
25+
26+
RUN apt-get update && \
27+
apt-get install -y \
28+
libgmp10 \
29+
&& \
30+
apt-get autoremove -y && \
31+
apt-get clean -y && \
32+
rm -rf /var/lib/apt/lists/*
33+
34+
COPY --from=build /usr/local/bin/semantic /usr/local/bin/semantic
35+
36+
ENTRYPOINT ["/usr/local/bin/semantic"]

0 commit comments

Comments
 (0)