A game developed for the Functional Programming chapter of Clojure for the Brave and True.
This project uses the Clojure tools CLI and tools.build.
Play the game:
clj -X:play
In order to build the uberjar using tools.build you will need Clojure CLI 1.10.3.933 or higher. Download the latest version from here.
curl -O https://download.clojure.org/install/linux-install-1.10.3.1075.sh
chmod +x linux-install-1.10.3.1075.sh
sudo ./linux-install-1.10.3.1075.sh
Running a tool with -T
will create a classpath that does not include the project :paths
and :deps
. Using -T:build
will use only the :paths
and :deps
from the :build
alias.
Build the uberjar using tools.build:
clj -T:build uber
# or, equivalently
clj -X:uberjar
Then run the standalone uberjar:
java -jar target/pegthing.core-1.2.9-standalone.jar
Run all tests with kaocha:
bin/kaocha
# for a more verbose output, use this reporter
bin/kaocha --reporter kaocha.report/documentation
Create the container image using pack and the Paketo Tiny Builder (BP
stands for Buildpack).
pack build pegthing:latest --builder paketobuildpacks/builder:tiny \
--env BP_JVM_TYPE=JRE \
--env BP_JVM_VERSION=11 \
--env BP_CLJ_TOOLS_BUILD_ARGUMENTS="-T:build uber"
Configuration with build-time environment variables:
Play the game inside a container:
docker run --rm --interactive --tty pegthing:latest
Inspect the generated container image with dive. For example you could try building the container image with --env BP_JVM_TYPE=JDK
first, and --env BP_JVM_TYPE=JRE
second. You will see that the container image containing the JRE is much smaller than the one containing the JDK.
dive pegthing:latest