Skip to content

Commit

Permalink
Change Dockerfile to fit elm-embed
Browse files Browse the repository at this point in the history
  • Loading branch information
emmabastas committed Mar 15, 2021
1 parent dc35627 commit ab3f3da
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions installers/linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Based initially on https://gist.github.com/rlefevre/1523f47e75310e28eee243c9c5651ac9
#
# Build Linux x64 binary from elm compiler top-level directory:
# $ docker build -t elm -f installers/linux/Dockerfile .
# $ docker build -t elm-embed -f installers/linux/Dockerfile .
#
# Retrieve elm Linux binary:
# $ docker cp $(docker create elm):/usr/local/bin/elm DESTINATION_DIRECTORY
# $ docker cp $(docker create elm-embed):/usr/local/bin/elm-embed DESTINATION_DIRECTORY
#
# Delete docker elm image:
# $ docker rmi elm
# Delete docker elm-embed image:
# $ docker rmi elm-embed
#
# Display all images:
# $ docker images -a
Expand All @@ -21,19 +21,18 @@ FROM alpine:3.11
# Install packages required to build elm
RUN apk add --no-cache ghc cabal wget musl-dev zlib-dev zlib-static ncurses-dev ncurses-static

WORKDIR /elm
WORKDIR /elm-embed

# Import source code
COPY builder builder
COPY compiler compiler
COPY reactor reactor
COPY terminal terminal
COPY cabal.config elm.cabal LICENSE ./
COPY cabal.config elm-embed.cabal LICENSE ./

# Build statically linked elm binary
RUN cabal new-update
RUN cabal new-build --ghc-option=-optl=-static --ghc-option=-split-sections
RUN cp ./dist-newstyle/build/x86_64-linux/ghc-*/elm-*/x/elm/build/elm/elm /usr/local/bin/elm
RUN cp ./dist-newstyle/build/x86_64-linux/ghc-*/elm-embed-*/x/elm-embed/build/elm-embed/elm-embed /usr/local/bin/elm-embed

# Remove debug symbols to optimize the binary size
RUN strip -s /usr/local/bin/elm
RUN strip -s /usr/local/bin/elm-embed

0 comments on commit ab3f3da

Please sign in to comment.