Improve slimming checks and integration
Change-Id: I96f0c6814e27c2caebff6a0b5ddb8c5284b66c0a
diff --git a/Dockerfile b/Dockerfile
index 42f1cf0..b4e5f01 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -100,13 +100,5 @@
# docker build -f Dockerfile -t korap/kalamar:x.xx-large --target kalamar .
-# Slimming (https://github.com/slimtoolkit/slim or https://github.com/mintoolkit/mint):
-# slim build --http-probe=true \
-# --exec="perl Makefile.PL && make test && unzip -v" \
-# --include-workdir=true \
-# --include-path="/usr/local/share/perl5/site_perl/KorAP/" \
-# --include-path="/usr/local/share/perl5/site_perl/Mojolicious/" \
-# --include-path="/usr/local/share/perl5/site_perl/Mojo/" \
-# --tag korap/kalamar:x.xx \
-# --tag korap/kalamar:latest \
-# korap/kalamar:x.xx-large
\ No newline at end of file
+# Slimming (https://github.com/mintoolkit/mint):
+# ./slim_script.sh "x.xx"
\ No newline at end of file
diff --git a/slim_script.sh b/slim_script.sh
new file mode 100755
index 0000000..bc3dd0c
--- /dev/null
+++ b/slim_script.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Get the version from the parameter or
+# the latest git tag or "latest"
+VERSION="${1:-$(git describe --tags --abbrev=0 2>/dev/null || echo "latest")}"
+
+# Remove the leading 'v' if it exists
+VERSION=${VERSION#v}
+
+# Build the docker-slim command
+slim build --http-probe=true \
+ --exec="perl Makefile.PL && make test && unzip -v" \
+ --include-workdir=true \
+ --include-path="/usr/local/share/perl5/site_perl/KorAP/" \
+ --include-path="/usr/local/share/perl5/site_perl/Mojolicious/" \
+ --include-path="/usr/local/share/perl5/site_perl/Mojo/" \
+ --tag "korap/kalamar:$VERSION" \
+ --tag "korap/kalamar:latest" \
+ "korap/kalamar:${VERSION}-large"
diff --git a/t/slim.t b/t/slim.t
index b79743a..f2fc78e 100644
--- a/t/slim.t
+++ b/t/slim.t
@@ -11,5 +11,13 @@
ok($cache);
+$cache = CHI->new(driver => 'File');
+
+ok($cache);
+
+$cache = CHI->new(driver => 'FastMmap');
+
+ok($cache);
+
done_testing;
__END__