Skip to content

Instantly share code, notes, and snippets.

@rlefevre
Last active October 29, 2019 14:22
Show Gist options
  • Select an option

  • Save rlefevre/e3db32d9915fb3d614bd0695de0a473c to your computer and use it in GitHub Desktop.

Select an option

Save rlefevre/e3db32d9915fb3d614bd0695de0a473c to your computer and use it in GitHub Desktop.

Revisions

  1. rlefevre renamed this gist Jul 11, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. rlefevre revised this gist Mar 19, 2019. No changes.
  3. rlefevre revised this gist Mar 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Elm Linux x64 statically linked binary
    # Elm 0.19.0 Linux x64 statically linked binary

    This document describes how to build a statically linked binary of Elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/). This is how the official Elm 0.19.0 Linux binary was built.

  4. rlefevre revised this gist Mar 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ This document describes how to build a statically linked binary of Elm 0.19.0 fo
    ## Why?

    #### Why build a statically linked binary?
    Elm is currently distributed using `npm`. For Linux x64 (but this applies to any architecture), this requires to have a single x64 binary that works on all Linux x64 distributions. This is considerably easier to achieve by building a statically linked binary that will only depend on the Linux kernel ABI and System Call Interface but not on userpace libraries.
    Elm is currently distributed using `npm`. For Linux x64 (but this applies to any architecture), this requires to have a single x64 binary that works on all Linux x64 distributions. This is considerably easier to achieve by building a statically linked binary that will only depend on the Linux kernel ABI and System Call Interface but not on userpace libraries (see [here](https://gist.github.com/rlefevre/e833f6fbd485f46a1352bce9b239932e) for a compatibility survey of a dynamically built executable).

    #### Why use docker?

  5. rlefevre revised this gist Mar 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Elm Linux x64 statically linked binary

    This document describes how to build a statically linked binary of Elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/). This is how the official Elm 0.19.0 Linux binary is built.
    This document describes how to build a statically linked binary of Elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/). This is how the official Elm 0.19.0 Linux binary was built.

    ## Why?

  6. rlefevre revised this gist Mar 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Elm Linux x64 statically linked binary

    This document describes how to build a statically linked binary of Elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/). This is how the official Linux binary is built.
    This document describes how to build a statically linked binary of Elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/). This is how the official Elm 0.19.0 Linux binary is built.

    ## Why?

  7. rlefevre revised this gist Mar 19, 2019. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Elm Linux x64 statically linked binary

    This document describes how to build a statically linked binary of Elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/).
    This document describes how to build a statically linked binary of Elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/). This is how the official Linux binary is built.

    ## Why?

    @@ -51,8 +51,9 @@ Maybe one day the docker build script could be included in elm sources but for n

    Create an empty directory named for example `elm-docker` (naming is not important) and add a `Dockerfile` file in it (naming is important) with the following content:
    ```
    # We use Alpine 3.7 that includes ghc 8.0.2 as the last Alpine version 3.8 includes ghc 8.4
    # that is not yet supported by the `language-glsl` haskell library used by elm.
    # We use Alpine 3.7 that includes ghc 8.0.2 as at the time of writing, the last
    # Alpine version 3.8 includes ghc 8.4 that is not yet supported by the `language-glsl`
    # haskell library used by elm.
    FROM alpine:3.7
    # Install required packages
  8. rlefevre revised this gist Dec 10, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -58,7 +58,7 @@ FROM alpine:3.7
    # Install required packages
    RUN apk add --update ghc cabal git musl-dev zlib-dev ncurses-dev ncurses-static
    # Checkout elm compiler (you can change git options to retrieve a specific tag or branch)
    # Checkout elm compiler (using 0.19.0 tag)
    WORKDIR /tmp
    RUN git clone -b 0.19.0 https://github.com/elm/compiler.git
    @@ -72,7 +72,7 @@ RUN cabal configure --disable-executable-dynamic --ghc-option=-optl=-static --gh
    RUN cabal build --jobs=1
    ```

    Take note of the comment above the git command. You can change some git options there if you want to use a specific elm tag/commit/branch.
    Take note of the comment above the git command. You can change some git options there if you want to use another elm tag/commit/branch.

    #### 3. Build the docker image including the statically linked elm binary

  9. rlefevre revised this gist Dec 10, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Elm Linux x64 statically linked binary

    This document describes how to build a statically linked binary of elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/).
    This document describes how to build a statically linked binary of Elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/).

    ## Why?

  10. rlefevre revised this gist Dec 10, 2018. 1 changed file with 2 additions and 6 deletions.
    8 changes: 2 additions & 6 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,6 @@
    # Elm Linux x64 statically linked binary

    This document describes how to build a statically linked binary of elm 0.19 alpha (HEAD of `master` by default) for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/).

    ## Download

    If you just want test the resulting statically linked binary, you can [download it here](https://drive.google.com/uc?export=download&id=1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r) (based on August 9 [commit 2a39658](https://github.com/elm/compiler/commit/2a396586c7a01be3ad053c6b018f62df830d689b) from elm compiler master branch).
    This document describes how to build a statically linked binary of elm 0.19.0 for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/).

    ## Why?

    @@ -64,7 +60,7 @@ RUN apk add --update ghc cabal git musl-dev zlib-dev ncurses-dev ncurses-static
    # Checkout elm compiler (you can change git options to retrieve a specific tag or branch)
    WORKDIR /tmp
    RUN git clone https://github.com/elm/compiler.git
    RUN git clone -b 0.19.0 https://github.com/elm/compiler.git
    # Build a statically linked elm binary
    WORKDIR /tmp/compiler
  11. rlefevre revised this gist Dec 10, 2018. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,3 @@
    **NOT FOR SHARING**: Please respect the wishes from Evan. Do not post elm 0.19 docker images to docker hub before the release, and keep the binaries and discussion inside slack #elm-dev for now.

    <br>

    # Elm Linux x64 statically linked binary

    This document describes how to build a statically linked binary of elm 0.19 alpha (HEAD of `master` by default) for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/).
  12. rlefevre revised this gist Aug 21, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -88,7 +88,7 @@ In the directory containing the `Dockerfile`, run:
    ```
    $ docker build -t elm .
    ```
    The `-t elm` option is used to name the docker image `elm`.
    The `-t elm` option is used to name the docker image `"elm"`, which will be useful to refer to it later.

    The steps automatically executed are:
    - fetch and run the Alpine Linux image inside a container
  13. rlefevre revised this gist Aug 20, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ If you just want test the resulting statically linked binary, you can [download
    ## Why?

    #### Why build a statically linked binary?
    Elm is currently distributed using `npm`. For Linux x64 (but this applies to any architecture), this requires to have a single x64 binary that works on all Linux x64 distributions. This is considerably easier to achieve by building a statically linked binary that will only depend on the Linux kernel ABI and not on userpace libraries.
    Elm is currently distributed using `npm`. For Linux x64 (but this applies to any architecture), this requires to have a single x64 binary that works on all Linux x64 distributions. This is considerably easier to achieve by building a statically linked binary that will only depend on the Linux kernel ABI and System Call Interface but not on userpace libraries.

    #### Why use docker?

  14. rlefevre revised this gist Aug 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ Elm is currently distributed using `npm`. For Linux x64 (but this applies to any

    Docker allows to automate and reproduce the build on any system that supports docker without creating some dependencies with the host system (in our case mainly the C libraries needed by elm, and particularly the libc). This lowers the requirements to rebuild elm, improves the builds reliability and allows to manage the whole build procedure in a version control system.

    #### Why use Alpine Linux?
    #### Why use Alpine Linux and musl libc?
    Glibc is not really suitable for static linking as it uses some dynamically loaded name resolution libraries that complicate static linking considerably (see this [FAQ](https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked_programs_need_some_shared_libraries_which_is_not_acceptable_for_me.__What_can_I_do.3F) and [NSS documentation](http://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html) for more information).

    Alpine Linux is a very small Linux distribution particularly suitable for Continuous Integration images that uses the [musl libc](https://www.musl-libc.org/) instead of glibc. The musl libc, defined on its homepage as "lightweight, fast, simple, free, and strives to be correct in the sense of standards-conformance and safe", is a nice alternative to glibc, particularly for static linking.
  15. rlefevre revised this gist Aug 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@

    # Elm Linux x64 statically linked binary

    This document describes how to build a statically linked binary of elm 0.19 alpha (HEAD of `master` by default) for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) and consequently statically linked to [musl libc](https://www.musl-libc.org/).
    This document describes how to build a statically linked binary of elm 0.19 alpha (HEAD of `master` by default) for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) in order to easily link it statically to [musl libc](https://www.musl-libc.org/).

    ## Download

  16. rlefevre revised this gist Aug 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ This document describes how to build a statically linked binary of elm 0.19 alph

    ## Download

    If you just want test the resulting statically linked binary, you can [download it here](https://drive.google.com/uc?export=download&id=1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r') (based on August 9 [commit 2a39658](https://github.com/elm/compiler/commit/2a396586c7a01be3ad053c6b018f62df830d689b) from elm compiler master branch).
    If you just want test the resulting statically linked binary, you can [download it here](https://drive.google.com/uc?export=download&id=1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r) (based on August 9 [commit 2a39658](https://github.com/elm/compiler/commit/2a396586c7a01be3ad053c6b018f62df830d689b) from elm compiler master branch).

    ## Why?

  17. rlefevre revised this gist Aug 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ This document describes how to build a statically linked binary of elm 0.19 alph

    ## Download

    If you just want test the resulting statically linked binary, you can [download it here](https://drive.google.com/file/d/1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r/view?usp=sharing) (based on August 9 [commit 2a39658](https://github.com/elm/compiler/commit/2a396586c7a01be3ad053c6b018f62df830d689b) from elm compiler master branch).
    If you just want test the resulting statically linked binary, you can [download it here](https://drive.google.com/uc?export=download&id=1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r') (based on August 9 [commit 2a39658](https://github.com/elm/compiler/commit/2a396586c7a01be3ad053c6b018f62df830d689b) from elm compiler master branch).

    ## Why?

  18. rlefevre revised this gist Aug 15, 2018. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -64,8 +64,7 @@ Create an empty directory named for example `elm-docker` (naming is not importan
    FROM alpine:3.7
    # Install required packages
    RUN apk update
    RUN apk add ghc cabal git musl-dev zlib-dev ncurses-dev ncurses-static
    RUN apk add --update ghc cabal git musl-dev zlib-dev ncurses-dev ncurses-static
    # Checkout elm compiler (you can change git options to retrieve a specific tag or branch)
    WORKDIR /tmp
  19. rlefevre revised this gist Aug 15, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,8 @@

    This document describes how to build a statically linked binary of elm 0.19 alpha (HEAD of `master` by default) for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) and consequently statically linked to [musl libc](https://www.musl-libc.org/).

    ## Download

    If you just want test the resulting statically linked binary, you can [download it here](https://drive.google.com/file/d/1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r/view?usp=sharing) (based on August 9 [commit 2a39658](https://github.com/elm/compiler/commit/2a396586c7a01be3ad053c6b018f62df830d689b) from elm compiler master branch).

    ## Why?
  20. rlefevre revised this gist Aug 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@

    This document describes how to build a statically linked binary of elm 0.19 alpha (HEAD of `master` by default) for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) and consequently statically linked to [musl libc](https://www.musl-libc.org/).

    If you just want test the resulting binary, you can [download it here](https://drive.google.com/file/d/1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r/view?usp=sharing) (based on August 9 [commit 2a39658](https://github.com/elm/compiler/commit/2a396586c7a01be3ad053c6b018f62df830d689b) from elm compiler master branch).
    If you just want test the resulting statically linked binary, you can [download it here](https://drive.google.com/file/d/1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r/view?usp=sharing) (based on August 9 [commit 2a39658](https://github.com/elm/compiler/commit/2a396586c7a01be3ad053c6b018f62df830d689b) from elm compiler master branch).

    ## Why?

  21. rlefevre revised this gist Aug 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@

    This document describes how to build a statically linked binary of elm 0.19 alpha (HEAD of `master` by default) for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) and consequently statically linked to [musl libc](https://www.musl-libc.org/).

    If you just want test the resulting binary, you can [download it here](https://drive.google.com/file/d/1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r/view?usp=sharing) (based on commit 2a39658 from elm compiler master branch from August 9).
    If you just want test the resulting binary, you can [download it here](https://drive.google.com/file/d/1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r/view?usp=sharing) (based on August 9 [commit 2a39658](https://github.com/elm/compiler/commit/2a396586c7a01be3ad053c6b018f62df830d689b) from elm compiler master branch).

    ## Why?

  22. rlefevre revised this gist Aug 15, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,8 @@

    This document describes how to build a statically linked binary of elm 0.19 alpha (HEAD of `master` by default) for Linux x64 using [docker](https://www.docker.com/). The binary is built using [Alpine Linux](https://alpinelinux.org/) and consequently statically linked to [musl libc](https://www.musl-libc.org/).

    If you just want test the resulting binary, you can [download it here](https://drive.google.com/file/d/1j-rvPqkUjLt4bnikEKs3oatjlXQKhT1r/view?usp=sharing) (based on commit 2a39658 from elm compiler master branch from August 9).

    ## Why?

    #### Why build a statically linked binary?
  23. rlefevre revised this gist Aug 15, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -60,6 +60,7 @@ Create an empty directory named for example `elm-docker` (naming is not importan
    FROM alpine:3.7
    # Install required packages
    RUN apk update
    RUN apk add ghc cabal git musl-dev zlib-dev ncurses-dev ncurses-static
    # Checkout elm compiler (you can change git options to retrieve a specific tag or branch)
  24. rlefevre revised this gist Aug 14, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ This document describes how to build a statically linked binary of elm 0.19 alph
    ## Why?

    #### Why build a statically linked binary?
    Elm is currently distributed using `npm`. For Linux x64 (but this applies to any architecture), this requires to have a single x64 binary that works on all Linux x64 distributions. This is considerably easier to achieve by building a statically linked binary that will only depend on the Linux kernel ABI and not on userpace.
    Elm is currently distributed using `npm`. For Linux x64 (but this applies to any architecture), this requires to have a single x64 binary that works on all Linux x64 distributions. This is considerably easier to achieve by building a statically linked binary that will only depend on the Linux kernel ABI and not on userpace libraries.

    #### Why use docker?

  25. rlefevre revised this gist Aug 14, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ Elm is currently distributed using `npm`. For Linux x64 (but this applies to any

    #### Why use docker?

    Docker allows to automate and reproduce the build on any system that supports docker without creating some dependencies with the host system (in our case the C libraries needed by elm, particularly the libc). This lowers the requirements to rebuild elm, improves the builds reliability and allows to manage the whole build procedure in a version control system.
    Docker allows to automate and reproduce the build on any system that supports docker without creating some dependencies with the host system (in our case mainly the C libraries needed by elm, and particularly the libc). This lowers the requirements to rebuild elm, improves the builds reliability and allows to manage the whole build procedure in a version control system.

    #### Why use Alpine Linux?
    Glibc is not really suitable for static linking as it uses some dynamically loaded name resolution libraries that complicate static linking considerably (see this [FAQ](https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked_programs_need_some_shared_libraries_which_is_not_acceptable_for_me.__What_can_I_do.3F) and [NSS documentation](http://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html) for more information).
  26. rlefevre revised this gist Aug 14, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ Elm is currently distributed using `npm`. For Linux x64 (but this applies to any

    #### Why use docker?

    Docker allows to automate and reproduce the build on any system that supports docker without creating some dependencies with the host system. This lowers the requirements to rebuild elm, improves the builds reliability and allows to manage the whole build procedure in a version control system.
    Docker allows to automate and reproduce the build on any system that supports docker without creating some dependencies with the host system (in our case the C libraries needed by elm, particularly the libc). This lowers the requirements to rebuild elm, improves the builds reliability and allows to manage the whole build procedure in a version control system.

    #### Why use Alpine Linux?
    Glibc is not really suitable for static linking as it uses some dynamically loaded name resolution libraries that complicate static linking considerably (see this [FAQ](https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked_programs_need_some_shared_libraries_which_is_not_acceptable_for_me.__What_can_I_do.3F) and [NSS documentation](http://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html) for more information).
  27. rlefevre revised this gist Aug 14, 2018. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -87,9 +87,9 @@ $ docker build -t elm .
    The `-t elm` option is used to name the docker image `elm`.

    The steps automatically executed are:
    - fetch and start the Alpine Linux image inside a container
    - install the required Alpine packages to build elm
    - build and install the haskell required libraries to build elm
    - fetch and run the Alpine Linux image inside a container
    - install the Alpine packages required to build elm
    - build the haskell libraries required to build elm
    - build elm

    If this goes well, this should end after a few minutes with something like:
    @@ -108,6 +108,8 @@ elm latest c2a967867158 2 hours ago
    alpine 3.7 791c3e2ebfcb 5 weeks ago 4.2MB
    ```

    Note that this image is not optimized for Continuous Integration of software written in elm as it includes all dependencies needed to build elm itself. We could make an image a lot smaller for this other purpose.

    #### 4. Retrieve the elm binary

    You can now retrieve the statically linked `elm` binary from the docker image.
  28. rlefevre revised this gist Aug 14, 2018. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions elm-static.md
    Original file line number Diff line number Diff line change
    @@ -100,6 +100,13 @@ Removing intermediate container ec629eeec5a1
    Successfully built c2a967867158
    Successfully tagged elm:latest
    ```
    Your new image should now be listed when running `docker images` in addition to the Alpine one used as our basis, for example:
    ```
    $ docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    elm latest c2a967867158 2 hours ago 1.75GB
    alpine 3.7 791c3e2ebfcb 5 weeks ago 4.2MB
    ```

    #### 4. Retrieve the elm binary

  29. rlefevre revised this gist Aug 14, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -105,7 +105,7 @@ Successfully tagged elm:latest

    You can now retrieve the statically linked `elm` binary from the docker image.

    As the elm compiler repository has been checked out in the `/tmp` image directory and built there, you can then copy the `elm` binary from the image container to the current directory using:
    As the elm compiler repository has been checked out in the `/tmp` image directory and built there, you can copy the `elm` binary from the image container to the current directory using:
    ```
    $ docker run elm cat /tmp/compiler/dist/build/elm/elm > elm
    ```
  30. rlefevre revised this gist Aug 14, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elm-static.md
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,7 @@ RUN cabal configure --disable-executable-dynamic --ghc-option=-optl=-static --gh
    RUN cabal build --jobs=1
    ```

    Note the comment above the git command. You can change some git options if you want to use a specific tag/commit/branch.
    Take note of the comment above the git command. You can change some git options there if you want to use a specific elm tag/commit/branch.

    #### 3. Build the docker image including the statically linked elm binary