Last active
July 28, 2018 15:21
-
-
Save etcinit/d484b72de336836a956eb51b3da231ad to your computer and use it in GitHub Desktop.
Haskell in Docker using Travis CI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo: required | |
services: | |
- docker | |
language: c | |
addons: | |
apt: | |
packages: | |
- libgmp-dev | |
env: | |
global: | |
secure: FAKE # You should `travis` to set the environment variables used by these scripts. | |
before_install: bash before-install.sh | |
before_script: mkdir dist | |
script: stack test --no-terminal --install-ghc --haddock --coverage --local-bin-path dist --copy-bins | |
cache: | |
directories: | |
- "$HOME/.stack" | |
- .stack-work | |
after_success: bash after-success.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
docker build -t myapp . | |
# If this is not a pull request, update the branch's docker tag. | |
if [ $TRAVIS_PULL_REQUEST = 'false' ]; then | |
docker tag myapp quay.io/myorg/myapp:${TRAVIS_BRANCH/\//-} \ | |
&& docker push quay.io/myorg/myapp:${TRAVIS_BRANCH/\//-}; | |
# If this commit has a tag, use on the registry too. | |
if ! test -z $TRAVIS_TAG; then | |
docker tag myapp quay.io/myorg/myapp:${TRAVIS_TAG} \ | |
&& docker push quay.io/myorg/myapp:${TRAVIS_TAG}; | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
mkdir -p ~/.local/bin | |
export PATH=$HOME/.local/bin:$PATH | |
curl -L https://www.stackage.org/stack/linux-x86_64 \ | |
| tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' | |
stack setup | |
stack install hscolour | |
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" \ | |
quay.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie | |
MAINTAINER Eduardo Trujillo <ed@chromabits.com> | |
RUN apt-get update && apt-get install -y libcurl4-gnutls-dev libgmp-dev | |
COPY dist/myapp /usr/local/bin/myapp | |
EXPOSE 80 | |
ENTRYPOINT ["/usr/local/bin/myapp"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment