IntersectMBO / IntersectMBO/govtool
[Packaging] Optimize image size of govtool/backend
- Dominant language
- HTML
- Stars
- 21
- Forks
- 29
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 7
Description
The current docker image size is of `5.39GB` which is very large for a simple service, compared to cardano-node or db-sync.
### Image size reported for different docker images
```
REPOSITORY TAG IMAGE ID CREATED SIZE
govtool/backend latest b6413eb58785 17 hours ago 5.39GB
govtool/backend-base latest 3a852d2c9dc2 22 hours ago 5.21GB
ghcr.io/intersectmbo/cardano-node ddba06d70271 7 months ago 911MB
ghcr.io/intersectmbo/cardano-node aef9e1df664f 7 months ago 928MB
```
### Suggestions
- Separate out docker image for build and runtime with multi-stage docker file.
- Exclude `ghc` in the final image. `ghc` build system is very large (~2Gb) this is not required at runtime.
- Exclude cabal store and packages in final image.
- Exclude dev libraries in final image e.g libpng-dev libpq-dev libreadline-dev libpsql-dev etc. These are only required for building backend with ghc and not during the runtime.
Contributor guide
Assessment
This issue has not been assessed yet.