Skip to content

Instantly share code, notes, and snippets.

@alunduil
Last active June 11, 2018 21:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alunduil/a026c7d5fb7cbeef06d626f2605109a6 to your computer and use it in GitHub Desktop.
Save alunduil/a026c7d5fb7cbeef06d626f2605109a6 to your computer and use it in GitHub Desktop.
Haskell Cloud Build to Heroku
steps:
- name: 'gcr.io/cloud-builders/docker'
args: [ 'pull', 'gcr.io/$PROJECT_ID/builder-api.dungeon.studio' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'pull', 'gcr.io/$PROJECT_ID/api.dungeon.studio' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build',
'--cache-from', 'gcr.io/$PROJECT_ID/builder-api.dungeon.studio',
'--cache-from', 'gcr.io/$PROJECT_ID/api.dungeon.studio',
'-t', '$_IMAGE_NAME',
'-f', 'Dockerfile', '.' ]
- name: 'gcr.io/cloud-builders/docker'
args: [ 'login', '--username=_', '--password=$_HEROKU_API_KEY', 'registry.heroku.com' ]
images:
- '$_IMAGE_NAME'
timeout: 60m
FROM alpine:3.7 as builder
MAINTAINER Alex Brandt <alunduil@alunduil.com>
RUN apk add --no-cache musl-dev zlib-dev
RUN apk add --no-cache cabal ghc
WORKDIR /usr/local/src/api.dungeon.studio
RUN cabal update
COPY ./*.cabal ./
RUN cabal install -j --only-dependencies
COPY . ./
RUN cabal build -j --ghc-options="-static -optc-static -optl-static -optl-pthread"
FROM alpine:3.7
MAINTAINER Alex Brandt <alunduil@alunduil.com>
RUN apk add --no-cache ca-certificates
COPY --from=builder /usr/local/src/api.dungeon.studio/dist/build/api-dungeon-studio/api-dungeon-studio /
ENTRYPOINT [ "/api-dungeon-studio" ]
CMD [ "Thanks Heroku!" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment