{"id":16339109,"url":"https://github.com/phadej/heroku-docker-haskell-test","last_synced_at":"2025-08-07T22:42:21.451Z","repository":{"id":31794661,"uuid":"35361167","full_name":"phadej/heroku-docker-haskell-test","owner":"phadej","description":"Heroku + docker + haskell = ?","archived":false,"fork":false,"pushed_at":"2015-05-11T12:20:46.000Z","size":2695,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T12:11:16.899Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://evening-earth-1057.herokuapp.com/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phadej.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-10T07:15:24.000Z","updated_at":"2019-08-25T02:17:03.000Z","dependencies_parsed_at":"2022-09-10T23:50:41.210Z","dependency_job_id":null,"html_url":"https://github.com/phadej/heroku-docker-haskell-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phadej/heroku-docker-haskell-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Fheroku-docker-haskell-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Fheroku-docker-haskell-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Fheroku-docker-haskell-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Fheroku-docker-haskell-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phadej","download_url":"https://codeload.github.com/phadej/heroku-docker-haskell-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Fheroku-docker-haskell-test/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269337941,"owners_count":24400170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T23:53:30.387Z","updated_at":"2025-08-07T22:42:21.391Z","avatar_url":"https://github.com/phadej.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Heroku + Docker + Haskell = ?\n\nThis experiment is triggered by many things:\n- I like Haskell\n- I like docker too\n- And I like how easy is Heroku\n- [Haskell Web Server in a 5MB Docker image](https://www.fpcomplete.com/blog/2015/05/haskell-web-server-in-5mb)\n- [Introducing 'heroku docker:release': Build \u0026amp; Deploy Heroku Apps with Docker](https://blog.heroku.com/archives/2015/5/5/introducing_heroku_docker_release_build_deploy_heroku_apps_with_docker)\n\n[evening-earth-1057.herokuapp.com](https://evening-earth-1057.herokuapp.com/) - Working example.\n\n## Starting point\n\nDeploying Haskell to heroku isn't simple, there are different buildpacks:\n- [Recommended \"Haskell on Heroku\"](https://github.com/mietek/haskell-on-heroku)\n- and [heroku-buildpack-ghc](https://github.com/begriffs/heroku-buildpack-ghc)\n\nWith both buildpacks, and Heroku overall, I don't like that building happens in the cloud.\nA bit like in the *AWS ELB* blog post, I'd rather build app locally (or on CI machine, or in *build* cloud), and deploy artifacts to Heroku.\n\nThere are two approaches!\n\n## inline-build-pack\n\nUsing [inline-build-pack](https://github.com/kr/heroku-buildpack-inline), we can build our app locally, bundle artifacts, and push to Heroku.\nAll three scripts: [`detect`](https://github.com/phadej/heroku-docker-haskell-test/blob/master/bin/detect), [`release`](https://github.com/phadej/heroku-docker-haskell-test/blob/master/bin/release), and [`compile`](https://github.com/phadej/heroku-docker-haskell-test/blob/master/bin/compile) turn out to be no-op.\nLooks like that on [cedar14](https://devcenter.heroku.com/articles/cedar-14-migration)\nstack, there is `libgmp.so.10`, so we don't need to bundle it anymore, as `heroku-buildpack-ghc` does.\nTurns out that [null-buildpack](https://github.com/ryandotsmith/null-buildpack) could be enough too.\n\nStill one problem still exist: how to build a heroku-runnable binary executable on e.g. OSX? Here the docker comes to help!\nUsing two simple scripts: [`prebuild`](https://github.com/phadej/heroku-docker-haskell-test/blob/master/bin/prebuild) and [`compilewithdocker`](https://github.com/phadej/heroku-docker-haskell-test/blob/master/bin/compilewithdocker) we produce needed executable.\n\nBut committing artifacts to the repository is highly unelegant!\n\n## Using heroku docker\n\nWe can build an own [`Dockerfile`](https://github.com/phadej/heroku-docker-haskell-test/blob/master/Dockerfile) to build the Haskell binaries. It's actually quite easy.\nUnfortunately (maybe for good) Dockerfiles doesn't support multi-inheritance, so we need to install GHC manually.\nFortunately I have previously done [docker ghc image](https://github.com/phadej/docker-ghc), so we can just copy paste GHC installing spells.\nAfter that we install few dependencies\u0026dagger; so we don't need to rebuild everything when deploying.\nAnd finally we build our application and leave it in `/app` directory which is then picked up by heroku deployment.\n\nThe first build takes time as then the build image is built, it took about 15 minutes on my machine.\nThe `heroku docker:release` takes under one minute. After update to use\n[`stackage-update`](https://github.com/fpco/stackage-update) in place of `cabal update` the `heroku docker:release`\ntakes about half a minute.\n\n## Conclusion\n\nUsing docker deployment you can tweak the build process, which is a huge win.\nHeroku infrastructure makes the other parts of deployment process and devops easy too.\nThe only negative aspect, *with greater power comes greater responsibility*, you can *accidentally* deploy uncommited changes.\n\n---\n\n## Remarks\n\n- \u0026dagger; we could add cabal file to docker and install exact dependencies\n- there is [`.dockerignore`](https://github.com/phadej/heroku-docker-haskell-test/blob/master/.dockerignore) to ignore host cabal sandbox one uses for development\n- This approach could be used to deploy scala (which takes enormous time to build e.g. play2 app), or to make Clojure deploy using uberjar.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphadej%2Fheroku-docker-haskell-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphadej%2Fheroku-docker-haskell-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphadej%2Fheroku-docker-haskell-test/lists"}