-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Unexpected dependencies when building docker image #155924
Copy link
Copy link
Closed
Labels
0.kind: questionRequests for a specific question to be answeredRequests for a specific question to be answered6.topic: closure sizeThe final size of a derivation, including its dependenciesThe final size of a derivation, including its dependencies6.topic: haskellGeneral-purpose, statically typed, purely functional programming languageGeneral-purpose, statically typed, purely functional programming language
Metadata
Metadata
Assignees
Labels
0.kind: questionRequests for a specific question to be answeredRequests for a specific question to be answered6.topic: closure sizeThe final size of a derivation, including its dependenciesThe final size of a derivation, including its dependencies6.topic: haskellGeneral-purpose, statically typed, purely functional programming languageGeneral-purpose, statically typed, purely functional programming language
Fields
Give feedbackNo fields configured for issues without a type.
I have the following default.nix:
And test.cabal looks like this:
Then I use docker.nix to build a docker image:
The resulting docker image is almost 400 MB, and contains ghc, gcc, documentation, and so on. However, if I remove the library from the cabal file, the resulting docker image is only 14 MB, and doesn't contain anything superfluous. I guess that when the cabal file contains a library, it becomes part of the build result, and since a library isn't useful on its own, it depends on ghc? However, I don't want to make the library available, it's only for building the executable. How can I get a lean docker image without a build environment, while keeping the library structure of the cabal project?