@@ -21,6 +21,7 @@ alpine_ver="3.14"
2121container=" ghc"
2222image=" ghc"
2323ghc_ver=" 8.10.7"
24+
2425# NOTE: The logic associated with this will have to change for GHC 9.x and up to
2526# support the changes introduced with the switch to `ghc-bignum`.
2627numeric=" gmp"
@@ -33,7 +34,7 @@ usage="USAGE: $0
3334 default: ${container}
3435 -g GHC_VER override the numeric library GHC is built against; either 'gmp' or 'simple'
3536 default: ${ghc_ver}
36- -i IMAGE override the default image name
37+ -i IMAGE override the default image base name
3738 default: ${image}
3839 -n NUMERIC override the numeric library GHC is built against; either 'gmp' or 'simple'
3940 default: ${numeric} "
@@ -172,10 +173,32 @@ buildah run "${container}" \
172173buildah run " ${container} " \
173174 rm -rf " /tmp/{build.mk,compile_ghc.sh,patches}"
174175
176+ # Add `ghcup`'s bin directory to the container's `PATH`.
177+ #
178+ # NOTE: This little bit of indirection is needed to get the container's 'PATH',
179+ # since '$PATH' would be sourced from the host.
180+ cntr_path=$( buildah run " ${container} " printenv PATH)
181+ buildah config \
182+ --env PATH=" ${cntr_path} :/root/.ghcup/bin" \
183+ " ${container} "
184+
175185# ###############################################################################
176186# Generate the final image.
177187# ###############################################################################
178188
189+ # NOTE: `buildah` uses `/var/tmp` (or $TMPDIR) as a staging area when assembling
190+ # images.
191+ #
192+ # On systems where `/var/tmp` is mounted as `tmpfs`, this can cause `buildah` to
193+ # run out of space.
194+ #
195+ # In this case, create some `./tmp` directory and use it with `TMPDIR=./tmp`
196+ # before running `buildah commit`.
197+ #
198+ # e.g. Uncomment the following:
199+ #
200+ # mkdir -p ./tmp
201+ # TMPDIR=./tmp \
179202buildah \
180203 --signature-policy=./policy.json \
181204 commit --rm " ${container} " " ${image} "
0 commit comments