{"id":13702319,"url":"https://github.com/utdemir/ghc-musl","last_synced_at":"2025-10-05T19:58:11.515Z","repository":{"id":37067162,"uuid":"225121943","full_name":"utdemir/ghc-musl","owner":"utdemir","description":"Docker image with GHC+musl for static executables","archived":false,"fork":false,"pushed_at":"2024-02-03T00:07:25.000Z","size":117,"stargazers_count":138,"open_issues_count":12,"forks_count":9,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-07-07T06:46:56.812Z","etag":null,"topics":["docker","hacktoberfest","haskell","musl","static-binaries"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/utdemir.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-01T07:19:25.000Z","updated_at":"2025-02-13T08:33:41.000Z","dependencies_parsed_at":"2024-10-27T10:56:13.584Z","dependency_job_id":"cc294d04-fcbb-4b0e-bea9-ccd401a21131","html_url":"https://github.com/utdemir/ghc-musl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/utdemir/ghc-musl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utdemir%2Fghc-musl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utdemir%2Fghc-musl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utdemir%2Fghc-musl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utdemir%2Fghc-musl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/utdemir","download_url":"https://codeload.github.com/utdemir/ghc-musl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utdemir%2Fghc-musl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278510917,"owners_count":25998997,"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-10-05T02:00:06.059Z","response_time":54,"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":["docker","hacktoberfest","haskell","musl","static-binaries"],"created_at":"2024-08-02T21:00:33.742Z","updated_at":"2025-10-05T19:58:11.481Z","avatar_url":"https://github.com/utdemir.png","language":"Shell","funding_links":[],"categories":["CI","Shell"],"sub_categories":["Dependencies analysers"],"readme":"\u003c!--\n\nWARNING: This file is auto-generated from ./update-readme.sh, modify\nthat instead.\n\n--\u003e\n\n# ghc-musl\n\nThis repository provides Docker images with GHC compiled with `musl`;\ntherefore can be used to create fully static Haskell binaries without\n`glibc` dependency on any platform which can run Docker (x86_64). Powered\nby [ghcup](https://www.haskell.org/ghcup/).\n\nImages come with `ghc` and `cabal` executables alongside with commonly\nused libraries and build tools. They can also be used with the `stack`\nbuild tool using its Docker integration.\n\nHere are the latest images currently [published in Docker Hub](https://hub.docker.com/r/utdemir/ghc-musl/tags):\n\n* utdemir/ghc-musl:v25-ghc944\n* utdemir/ghc-musl:v25-ghc925\n* utdemir/ghc-musl:v25-ghc902\n* utdemir/ghc-musl:v25-ghc8107\n* utdemir/ghc-musl:v25-ghc884\n\n## Usage\n\n### cabal-install\n\nMount the project directory to the container, and use `cabal-install`\nwith `--enable-executable-static` flag inside the container:\n\n```\n$ cd myproject/\n$ docker run -itv $PWD:/mnt utdemir/ghc-musl:v25-ghc944\nsh$ cd /mnt\nsh$ cabal new-update\nsh$ cabal new-build --enable-executable-static\n```\n\nYou can also set `executable-static` [option](https://cabal.readthedocs.io/en/latest/cabal-project.html#cfg-field-executable-static) on your `cabal.project` file.\n\n### stack\n\nUse below arguments, or set the relevant options on your `stack.yaml`:\n\n```\nstack build \\\n  --ghc-options ' -static -optl-static -optl-pthread -fPIC' \\\n  --docker --docker-image \"utdemir/ghc-musl:v25-ghc944\" \\\n  --no-nix\n```\n\nMake sure to pick an image with the GHC version compatible with the\nStackage resolver you are using.\n\nFollow https://github.com/commercialhaskell/stack/issues/3420 for\nmore details on static compilation using the Stack build tool.\n\n### Example session with GHC\n\nBelow shell session shows how to start a pre-compiled docker container\nand compile a simple `Hello.hs` as a static executable:\n\n```\n$ docker run -itv $PWD:/mnt utdemir/ghc-musl:v25-ghc944\nbash-4.4# cd /mnt/\nbash-4.4# cat Hello.hs\nmain = putStrLn \"Hello\"\nbash-4.4# ghc --make -optl-static -optl-pthread Hello.hs\n[1 of 1] Compiling Main             ( Hello.hs, Hello.o )\nLinking Hello ...\nbash-4.4# ls -al Hello\n-rwxr-xr-x 1 root root 1185056 Aug 11 16:55 Hello\nbash-4.4# file Hello\nHello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped\nbash-4.4# ldd ./Hello\nldd: ./Hello: Not a valid dynamic program\n```\n\nThe result can be executed on different Linux systems:\n\n```\n$ docker run -itv $PWD:/mnt alpine\n# /mnt/Hello\nHello\n```\n\n```\n$ docker run -itv $PWD:/mnt centos\n[root@94eb29dcdfe6 /]# /mnt/Hello\nHello\n```\n\n## Development\n\nFeel free to open an issue or send a PR to add a library or support a\nnewer compiler version.\n\nThe build process is orchestrated using [Earthly][]. Once it is installed\n(or obtained via \"nix-shell -p earthly\"), you can use below command to build\nand test all images:\n\n```\nearthly --allow-privileged +all\n```\n\nNote: `--allow-privileged` is only necessary because we use Docker-in-Docker\nproject to test if the generated images work with `stack`'s Docker support.\nYou can use the following command to disable Stack tests so that\n`--allow-privileged` is not necessary:\n\n```\nearthly --build-arg TEST_STACK=0 +all\n```\n\nThe following command updates `README.md`:\n\n```\nearthly --artifact +readme/README.md\n```\n\n[Earthly]: https://earthly.dev\n\n## Related\n\n* Multi-arch: \u003chttps://github.com/benz0li/ghc-musl\u003e\n  * `os/arch`'s: `linux/amd64`, `linux/arm64/v8`\n  * Built using Hadrian, from source, without docs\n* \u003chttps://gitlab.com/neosimsim/docker-builder-images\u003e\n* Using Nix: \u003chttps://github.com/nh2/static-haskell-nix\u003e\n* Not maintained: \u003chttps://github.com/fpco/docker-static-haskell\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futdemir%2Fghc-musl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Futdemir%2Fghc-musl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futdemir%2Fghc-musl/lists"}