Instantly share code, notes, and snippets.

@etcinit /.travis.yml
Last active Jul 28, 2018

Embed
What would you like to do?
Haskell in Docker using Travis CI
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
#!/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
#!/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
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