git.iko.soy/lynxjs-elm/compiler
on master help sign in
Merge pull request #2033 from rlefevre/travis-ci-linux

add Travis CI Linux x86_64 build and tags releases

commit035c603deb008543a0c5f1a9517601c53036ef8b authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 4 Feb 2020, 12:08 (7 years ago) parenta58ce8e1a45b8e
3 files changed+62−19
.gitignore+1 .travis.yml+28 installers/linux/Dockerfile+33−19
.gitignore+1
@@ -5,3 +5,4 @@ cabal-dev
55cabal.sandbox.config
66.DS_Store
77*~
8+travis.log
.travis.ymlnew file+28
@@ -0,0 +1,28 @@
1+language: minimal
2+services: docker
3+
4+env:
5+ global:
6+ - LINUX_ARCHIVE=binary-for-linux-64-bit.gz
7+
8+before_install:
9+ - docker build -t elm -f installers/linux/Dockerfile .
10+ - docker cp $(docker create elm):/usr/local/bin/elm .
11+ - gzip -9 -c elm > $LINUX_ARCHIVE
12+
13+deploy:
14+ provider: releases
15+ api_key:
16+ secure: Yz2Lo4u9rZQ7Ee7ohAsrZpkqsYDUerCSMdSQIH8ryrf7phHhiloPEkTKsM+NupHqU/LEAVsunxbau4QrCEjA2vPavAPVk8cKomRUWK/YjbXHKa24hPkal2c+A2bnMQ6w3qYk/PjL9rW+Goq++/SNLcYZwHBV0Chl2blivMwWCSA=
17+ file: $LINUX_ARCHIVE
18+ skip_cleanup: true
19+ on:
20+ branch: master
21+ tags: true
22+
23+notifications:
24+ email:
25+ recipients:
26+ - rlefevre@dmy.fr
27+ on_success: change
28+ on_failure: change
installers/linux/Dockerfile+33−19
@@ -1,25 +1,39 @@
1−# Create: https://gist.github.com/rlefevre/1523f47e75310e28eee243c9c5651ac9
2−# Delete: docker system prune -a ; docker images -a
1+# Based initially on https://gist.github.com/rlefevre/1523f47e75310e28eee243c9c5651ac9
2+#
3+# Build Linux x64 binary from elm compiler top-level directory:
4+# $ docker build -t elm -f installers/linux/Dockerfile .
5+#
6+# Retrieve elm Linux binary:
7+# $ docker cp $(docker create elm):/usr/local/bin/elm DESTINATION_DIRECTORY
8+#
9+# Delete docker elm image:
10+# $ docker rmi elm
11+#
12+# Display all images:
13+# $ docker images -a
14+#
15+# Delete all unused docker images:
16+# $ docker system prune -a
317
4−FROM alpine:3.10
18+# Use Alpine 3.11 with GHC 8.6.5
19+FROM alpine:3.11
520
6−# branch
7−ARG branch=master
8−# commit or tag
9−ARG commit=HEAD
21+# Install packages required to build elm
22+RUN apk add --no-cache ghc cabal wget musl-dev zlib-dev zlib-static ncurses-dev ncurses-static
1023
11−# Install required packages
12−RUN apk add --update ghc cabal git musl-dev zlib-dev ncurses-dev ncurses-static wget
24+WORKDIR /elm
1325
14−# Checkout elm compiler
15−WORKDIR /tmp
16−RUN git clone -b $branch https://github.com/elm/compiler.git
26+# Import source code
27+COPY builder builder/
28+COPY compiler compiler
29+COPY reactor reactor/
30+COPY terminal terminal/
31+COPY cabal.config elm.cabal LICENSE ./
1732
18−# Build a statically linked elm binary
19−WORKDIR /tmp/compiler
20−RUN git checkout $commit
21−RUN rm worker/elm.cabal
33+# Build statically linked elm binary
2234RUN cabal new-update
23−RUN cabal new-configure --disable-executable-dynamic --ghc-option=-optl=-static --ghc-option=-optl=-pthread
24−RUN cabal new-build
25−RUN strip -s ./dist-newstyle/build/x86_64-linux/ghc-8.4.3/elm-0.19.1/x/elm/build/elm/elm
35+RUN cabal new-build --ghc-option=-optl=-static --ghc-option=-split-sections
36+RUN cp ./dist-newstyle/build/x86_64-linux/ghc-*/elm-*/x/elm/build/elm/elm /usr/local/bin/elm
37+
38+# Remove debug symbols to optimize the binary size
39+RUN strip -s /usr/local/bin/elm