-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would you be so kind as to include stack? #26
Comments
Indeed, Stack usage is currently supported via Stack's Docker integration, where Stack on a host can use a Including Stack in the container image should not be a problem. It can be configured to use the GHC that is already installed within the container, so adding it should result in only a ~77MB increase in the image size. I will test this as soon as I get a chance, hopefully soon. |
With this commit, Stack is installed in the image, to allow users to use the image for CI builds. Stack is configured to use the system GHC. As with Cabal, it is up to users to ensure that build configuration matches the version of GHC in the image. Implementation details: * I replaced the `ghcup` and `ghc` targets with a single `haskell` target that installs GHCup, Cabal, GHC, and Stack. Separate targets are not used in order to minimize Docker layers. * The existing `test-stack` target is renamed to `task-stack-docker`. It tests using Stack Docker support. * A new `test-stack` target tests using the Stack installed in the image. * The `image` target now has three argument test flags: `TEST_CABAL` to enable/disable the `test-cabal` target, `TEST_STACK` to enable/disable the `test-stack` target, and `TEST_STACK_DOCKER` to enabled/disable the `test-stack-docker` target. * I added the appropriate `ld-options` to the `.cabal` file for the example project, so that they do not have to passed via the command line. Note that my future documentation changes will provide information about how to configure static builds using both Cabal and Stack. * The example project that is used for testing has a `stack.yaml` file that sets `skip-ghc-check` to true so that the project will build no matter what version of GHC is available, even when it does not match the version specified by the resolver. This continues to work for this test project.
I implemented this in the above-linked commit. Looking at the image sizes (for GHC 9.2.4), it results in ~1.69 GB increase. So much for my ~77MB estimate! 😆 That ~77MB is for the Stack installation, but quite a bit is stored in the
@utdemir What do you think? If you would like to include this, I suggest the following steps:
By the way, I hope to resume/restart my new documentation changes soon, but I doubt I will have time to get to it this weekend. |
@TravisCardwell thank you for working on this and your investigations! I feel pretty much the same with you, having I wonder if there can be a compromise. What if we were to include @why-not-try-calmer what do you think? Does having stack in the images, but still having to do a @TravisCardwell otherwise, I'm happy with the steps you suggested. |
I have been thinking along the same lines. I can add a flag so that Running Would you like to do the same with Cabal, by chance?
|
This commit adds `CABAL_UPDATE` and `STACK_UPDATE` flags. These flags can be used to enable/disable running `cabal update` and `stack update` respectively. Currently, `cabal update` is enabled by default and `stack update` is disabled by default, but users can use build arguments to specify otherwise. Here are the resulting sizes (for GHC 9.2.4 and Alpine 3.16.1): | `cabal update` | `stack update` | Image Size | Relative Image Size | | :------------- | :------------- | ---------: | ------------------: | | Disabled | Disabled | 2.83GB | 100% | | Enabled | Disabled | 3.76GB | 133% | | Enabled | Enabled | 5.37GB | 190% | Implementation details: * These new flags are defined at the top level, not within the `haskell` context. The reason for this is that Cabal fails when attempting to build before updating. By defining the flags at the top level, we are able to run `cabal update` within the `cabal-test` target only when it was not already run within the `haskell` target.
Here is the table from the above commit message, so that GitHub will render it:
|
Hello, thanks for working on this, I think it's very reasonable to expect the end user to run So thanks a lot guys, really appreciated! Looking forward to using these brand new images. |
I was enthusiast when I read that
Images come with ghc and cabal executables alongside with commonly used libraries and build tools.
Finding out thatstack
must be manually installed was disappointing. Of course, it's quite simple for the end user to addstack
, but I think this does not honor the promise made in the sentence quoted.Let's not forget all those who enjoy easy builds from Stackage snapshots... :)
edit: I realize there is a Stack workflow that is already supported, i.e using Stack from the host to build the target image. But you base image also allows to produce nice statically linked executables from outside the host, i.e. from a CI/CD runner. It is in particular in this context that it would be appreciable to have Stack pre-installed, so as to be able to use the image you offer as a build context to copy an executable from.
The text was updated successfully, but these errors were encountered: