Open AlistairB opened 2 years ago
Saving the 8.10 attempt before squash. The remaining issue is stack does not recognise GHC as being installed
FROM alpine:3.15
RUN apk add --no-cache \
ca-certificates \
curl \
bash \
gcc \
git \
g++ \
musl-dev \
ncurses-dev \
libc-dev \
libffi-dev
ARG CABAL_INSTALL=3.6.2.0
ARG CABAL_INSTALL_RELEASE_KEY=A970DF3AC3B9709706D74544B3D9F94B8DCAE210
RUN set -eux; \
apk add --no-cache --virtual .fetch-deps gnupg; \
cd /tmp; \
ARCH="$(apk --print-arch)"; \
CABAL_INSTALL_TAR="cabal-install-$CABAL_INSTALL-$ARCH-linux-alpine.tar.xz"; \
CABAL_INSTALL_URL="https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL/$CABAL_INSTALL_TAR"; \
CABAL_INSTALL_SHA256SUMS_URL="https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL/SHA256SUMS"; \
# sha256 from https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL/SHA256SUMS
case "$ARCH" in \
'x86_64') \
CABAL_INSTALL_SHA256='2d3d5e4aa83aad06ed723d7038eac41271d62b56251e0a76fa35db5f902250e3'; \
;; \
*) echo >&2 "error: unsupported architecture '$ARCH'"; exit 1 ;; \
esac; \
curl -sSL "$CABAL_INSTALL_URL" -o cabal-install.tar.gz; \
echo "$CABAL_INSTALL_SHA256 cabal-install.tar.gz" | sha256sum -c; \
\
curl -sSLO "$CABAL_INSTALL_SHA256SUMS_URL"; \
curl -sSLO "$CABAL_INSTALL_SHA256SUMS_URL.sig"; \
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
gpg --batch --keyserver keyserver.ubuntu.com --receive-keys "$CABAL_INSTALL_RELEASE_KEY"; \
gpg --batch --verify SHA256SUMS.sig SHA256SUMS; \
# confirm we are verying SHA256SUMS that matches the release + sha256
grep "$CABAL_INSTALL_SHA256 $CABAL_INSTALL_TAR" SHA256SUMS; \
gpgconf --kill all; \
\
tar -xf cabal-install.tar.gz -C /usr/local/bin; \
\
rm -rf /tmp/*; \
apk del --no-network .fetch-deps; \
\
cabal --version
ARG GHC=8.10.7
ARG GHC_RELEASE_KEY=88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4
RUN set -eux; \
apk add --no-cache --virtual .fetch-deps gnupg make; \
cd /tmp; \
ARCH="$(apk --print-arch)"; \
GHC_URL="https://downloads.haskell.org/~ghc/$GHC/ghc-$GHC-$ARCH-alpine3.10-linux-integer-simple.tar.xz"; \
# sha256 from https://downloads.haskell.org/~ghc/$GHC/SHA256SUMS
case "$ARCH" in \
'x86_64') \
GHC_SHA256='16903df850ef73d5246f2ff169cbf57ecab76c2ac5acfa9928934282cfad575c'; \
;; \
*) echo >&2 "error: unsupported architecture '$ARCH'" ; exit 1 ;; \
esac; \
curl -sSL "$GHC_URL" -o ghc.tar.xz; \
echo "$GHC_SHA256 ghc.tar.xz" | sha256sum -c; \
\
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
curl -sSL "$GHC_URL.sig" -o ghc.tar.xz.sig; \
gpg --batch --keyserver keyserver.ubuntu.com --receive-keys "$GHC_RELEASE_KEY"; \
gpg --batch --verify ghc.tar.xz.sig ghc.tar.xz; \
gpgconf --kill all; \
\
tar xf ghc.tar.xz; \
cd "ghc-$GHC-$ARCH-unknown-linux"; \
./configure --prefix "/opt/ghc/$GHC" --disable-ld-override; \
make install; \
# remove profiling support to save space
find "/opt/ghc/$GHC/" \( -name "*_p.a" -o -name "*.p_hi" \) -type f -delete; \
# remove some docs
rm -rf "/opt/ghc/$GHC/share/"; \
# for some reason the 8.10 alpine release has runghc not runhaskell
mv "/opt/ghc/$GHC/bin/runghc" "/opt/ghc/$GHC/bin/runhaskell"; \
\
rm -rf /tmp/*; \
apk del --no-network .fetch-deps; \
\
"/opt/ghc/$GHC/bin/ghc" --version
ARG STACK=2.7.3
ARG STACK_RELEASE_KEY=C5705533DA4F78D8664B5DC0575159689BEFB442
RUN set -eux; \
apk add --no-cache --virtual .fetch-deps gnupg; \
cd /tmp; \
ARCH="$(apk --print-arch)"; \
STACK_URL="https://github.com/commercialhaskell/stack/releases/download/v${STACK}/stack-${STACK}-linux-$ARCH.tar.gz"; \
# sha256 from https://github.com/commercialhaskell/stack/releases/download/v${STACK}/stack-${STACK}-linux-$ARCH.tar.gz.sha256
case "$ARCH" in \
'x86_64') \
STACK_SHA256='a6c090555fa1c64aa61c29aa4449765a51d79e870cf759cde192937cd614e72b'; \
;; \
*) echo >&2 "error: unsupported architecture '$ARCH'" ; exit 1 ;; \
esac; \
curl -sSL "$STACK_URL" -o stack.tar.gz; \
echo "$STACK_SHA256 stack.tar.gz" | sha256sum -c; \
\
curl -sSL "$STACK_URL.asc" -o stack.tar.gz.asc; \
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
gpg --batch --keyserver keyserver.ubuntu.com --receive-keys "$STACK_RELEASE_KEY"; \
gpg --batch --verify stack.tar.gz.asc stack.tar.gz; \
gpgconf --kill all; \
\
tar -xf stack.tar.gz -C /usr/local/bin --strip-components=1 "stack-$STACK-linux-$ARCH/stack"; \
stack config set system-ghc --global true; \
stack config set install-ghc --global false; \
\
rm -rf /tmp/*; \
apk del --no-network .fetch-deps; \
\
stack --version;
ENV PATH /root/.cabal/bin:/root/.local/bin:/opt/ghc/${GHC}/bin:$PATH
CMD ["ghci"]
OT: I can reproduce a (apparently non linker segfault) under GHC 9.2.3 on both the official Alpine binaries, both bignum-native and the GMP build.
In my case GHC crashes when evaluating an runIO $ readFile "someFile"
TH splice.
Currently compiling GHC head with debug symbols to nail this down a bit.
Thanks @mbj for your activity on the issue. Hopefully it can be fixed, although that issue does not seem to be scheduled to be resolved in 9.2.4 :(
22
Testing with
docker build 9.0/alpine3.15/ -t woo && docker run -it woo sh
~This is blocked until 9.2.2 as 9.2.1 release appears to be broken.~ 9.2.2 appear to still be broken. Waiting on new release that works.
Notes
curl
, ascabal update
was failing to use the alpinewget
.Issues / To Do
CTRL + D
exit fromsh
after exiting fromghci
I guess we can only support alpine 3.12 as the GHC releases are only for 3.12? (3.14 was seg faulting when I tried to load ghci)It seems 9.2.1 is just broken, but 9.0.2 and 8.10.7 will just work with newer alpine versions.Pre Release