Skip to content

Commit

Permalink
resolves #20 use stack to build a statically linked binary of erd
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Oct 9, 2019
1 parent ac9d499 commit 9b4c510
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildDockerImages:
cd mermaid && $(MAKE) package

tagDockerImages:
docker tag kroki-builder-static-erd:latest kroki-builder-static-erd:0.1.3.0
docker tag kroki-builder-static-erd:latest kroki-builder-static-erd:0.2.0.0
docker tag kroki-builder-static-svgbob:latest kroki-builder-static-svgbob:0.4.1
docker tag kroki-builder-nomnoml:latest kroki-builder-nomnoml:0.6.1

Expand Down
19 changes: 10 additions & 9 deletions server/ops/docker/build-static-erd
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# build static executable binary
FROM haskell:8
FROM ubuntu:18.04

RUN apt-get update && apt-get install -y graphviz curl git

RUN curl -sSL https://get.haskellstack.org/ | sh

RUN git clone https://github.com/BurntSushi/erd.git

WORKDIR erd

# version 0.1.3.0
RUN git checkout c443372d431a5020afa91989829352a2aa6b07cb

# use "old" commands on purpose to workaround an issue with static link
RUN cabal update
RUN cabal install --only-dependencies --force-reinstalls
RUN cabal configure --disable-executable-dynamic --disable-shared --ghc-option=-optl=-static \
&& cabal build
RUN git checkout v0.2.0.0

RUN /usr/local/bin/stack install --ghc-options="-fPIC" \
--ghc-options="-static" \
--ghc-options="-optl=-static" \
--ghc-options="-optc=-static"
2 changes: 1 addition & 1 deletion server/ops/docker/jdk11-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM adoptopenjdk/openjdk11:jdk-11.0.2.9-alpine-slim

COPY --from=kroki-builder-static-svgbob:0.4.1 /home/rust/src/svgbob_cli/target/x86_64-unknown-linux-musl/release/svgbob /rust/bin/svgbob
COPY --from=kroki-builder-static-erd:0.1.3.0 /erd/dist/build/erd/erd /haskell/bin/erd
COPY --from=kroki-builder-static-erd:0.2.0.0 /root/.local/bin/erd /haskell/bin/erd
COPY --from=kroki-builder-nomnoml:0.6.1 /app/app.bin /node/bin/nomnoml

ENV KROKI_SVGBOB_BIN_PATH=/rust/bin/svgbob
Expand Down
2 changes: 1 addition & 1 deletion server/ops/docker/jdk11-slim-stretch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM openjdk:11.0.1-jdk-slim-stretch

COPY --from=kroki-builder-static-svgbob:0.4.1 /home/rust/src/svgbob_cli/target/x86_64-unknown-linux-musl/release/svgbob /rust/bin/svgbob
COPY --from=kroki-builder-static-erd:0.1.3.0 /erd/dist/build/erd/erd /haskell/bin/erd
COPY --from=kroki-builder-static-erd:0.2.0.0 /root/.local/bin/erd /haskell/bin/erd
COPY --from=kroki-builder-nomnoml:0.6.1 /app/app.bin /node/bin/nomnoml

ENV KROKI_SVGBOB_BIN_PATH=/rust/bin/svgbob
Expand Down
2 changes: 1 addition & 1 deletion server/ops/docker/jdk8-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM openjdk:8u191-jdk-alpine3.8

COPY --from=kroki-builder-static-svgbob:0.4.1 /home/rust/src/svgbob_cli/target/x86_64-unknown-linux-musl/release/svgbob /rust/bin/svgbob
COPY --from=kroki-builder-static-erd:0.1.3.0 /erd/dist/build/erd/erd /haskell/bin/erd
COPY --from=kroki-builder-static-erd:0.2.0.0 /root/.local/bin/erd /haskell/bin/erd
COPY --from=kroki-builder-nomnoml:0.6.1-alpine /app/app.bin /node/bin/nomnoml

RUN apk add --update --no-cache \
Expand Down

0 comments on commit 9b4c510

Please sign in to comment.