exercism / haskell-test-runner

GNU Affero General Public License v3.0
1 stars 13 forks source link

Reduce image size #81

Closed ErikSchierboom closed 1 year ago

ErikSchierboom commented 1 year ago

In order to reduce the image size, I'm now:

This change shaves off almost 4GB from the image!

exercism/haskell-test-runner      latest f37510e50dca   16 hours ago    2.62GB
exercism/haskell-test-runner-old  latest a92e873e247e   19 hours ago    6.56GB

I've tried to use Alpine as the base image, but got hit by https://github.com/NixOS/nixpkgs/issues/84670

ErikSchierboom commented 1 year ago

@MatthijsBlom Let me know when you're around to test if this doesn't break anything

MatthijsBlom commented 1 year ago

As of yet I have no experience with Docker. I do not see any reason why this might break anything, but I would be more confident if a solution with dependencies were tested as well. I suggest parallel-letter-frequency.

ErikSchierboom commented 1 year ago

@MatthijsBlom Added: https://github.com/exercism/haskell-test-runner/pull/81/commits/6b1a1391c2f9c644c90cdc7496dc9fbd0b17b97d

I assume that this bit declares the dependency:

library:
  exposed-modules: Frequency
  source-dirs: src
  dependencies:
    - parallel
MatthijsBlom commented 1 year ago

Yes, it does. I chose parallel-letter-frequency because the parallel package is not available by default.

ErikSchierboom commented 1 year ago

🤞

MatthijsBlom commented 1 year ago

When will this be live?

Errors are logged and can be checked for abundance later today?

ErikSchierboom commented 1 year ago

It is live on the deploy was done: https://github.com/exercism/haskell-test-runner/actions/runs/4882124940

MatthijsBlom commented 1 year ago

This seems to have broken things after all.

Running Hello World in the web editor produces

hello-world> configure (lib + test)
Cabal-simple_SvXsv1f__3.6.3.0_ghc-9.2.7: internal error: Itimer: Failed to spawn thread: Operation not permitted
    (GHC version 9.2.7 for x86_64_unknown_linux)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the following errors:

       [S-7011]
       While building package hello-world-1.1.0.5 (scroll up to its section to see the error) using:
       /opt/test-runner/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_SvXsv1f__3.6.3.0_ghc-9.2.7 --verbose=1 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.6.3.0 configure --with-ghc=/opt/test-runner/.stack/programs/x86_64-linux/ghc-tinfo6-9.2.7/bin/ghc-9.2.7 --with-ghc-pkg=/opt/test-runner/.stack/programs/x86_64-linux/ghc-tinfo6-9.2.7/bin/ghc-pkg-9.2.7 --user --package-db=clear --package-db=global --package-db=/opt/test-runner/.stack/snapshots/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/pkgdb --package-db=/mnt/exercism-iteration/.stack-work/install/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/pkgdb --libdir=/mnt/exercism-iteration/.stack-work/install/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/lib --bindir=/mnt/exercism-iteration/.stack-work/install/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/bin --datadir=/mnt/exercism-iteration/.stack-work/install/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/share --libexecdir=/mnt/exercism-iteration/.stack-work/install/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/libexec --sysconfdir=/mnt/exercism-iteration/.stack-work/install/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/etc --docdir=/mnt/exercism-iteration/.stack-work/install/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/doc/hello-world-1.1.0.5 --htmldir=/mnt/exercism-iteration/.stack-work/install/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/doc/hello-world-1.1.0.5 --haddockdir=/mnt/exercism-iteration/.stack-work/install/x86_64-linux-tinfo6/b619258d6966f5bd3936086822f76804dd86ceeb340c20399e1915bb8986a2c5/9.2.7/doc/hello-world-1.1.0.5 --dependency=base=base-4.16.4.0 --dependency=hspec=hspec-2.9.7-JoSIxCtQL2PIyabvRkgvFB --exact-configuration --ghc-option=-fhide-source-paths --enable-tests
       Process exited with code: ExitFailure (-6)
MatthijsBlom commented 1 year ago

Maybe applicable: https://gitlab.haskell.org/ghc/ghc/-/issues/21477 says:

Naturally, it appears that this is actually due to a Docker bug: https://github.com/moby/moby/issues/42680.

See also https://gitlab.haskell.org/ghc/ghc/-/issues/21604.

ErikSchierboom commented 1 year ago

@MatthijsBlom I've reverted