├── Dockerfile ├── LICENSE └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM oracle/graalvm-ce:19.3.2 2 | 3 | RUN curl -O https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein && \ 4 | chmod +x lein && \ 5 | mv lein /usr/bin/lein && \ 6 | lein upgrade 7 | 8 | RUN gu install native-image 9 | 10 | CMD ["lein", "native-image"] 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 valerauko 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Leiningen GraalVM native builder image 2 | 3 | Docker image to build GraalVM native images out of your Clojure project. Has all the tools (GraalVM, native-image, lein) ready to go. 4 | 5 | ## Where 6 | 7 | * `valerauko/clojure-graal:latest` 8 | * `valerauko/clojure-graal:openjdk-11` 9 | 10 | ## Usage 11 | 12 | Normally you'd use it as the first stage for a [multi-stage build](https://docs.docker.com/develop/develop-images/multistage-build/). 13 | 14 | Mount/add your stuff and then run `lein native-image`. 15 | 16 | You'll have to properly configure the build options in your project.clj. 17 | 18 | ### Example 19 | 20 | Using https://github.com/yogthos/graal-web-app-example after adding the `--no-fallback` option: 21 | 22 | ``` 23 | $ pwd 24 | /home/valerauko/graal-web-app-example 25 | 26 | $ docker run --rm -v $(pwd):/build -w /build valerauko/clojure-graal 27 | Retrieving io/taylorwood/lein-native-image/0.3.0/lein-native-image-0.3.0.pom from clojars 28 | Retrieving nrepl/lein-nrepl/0.3.2/lein-nrepl-0.3.2.pom from clojars 29 | ... 30 | Retrieving nrepl/nrepl/0.6.0/nrepl-0.6.0.jar from clojars 31 | [/build/target/app:72] classlist: 4,874.38 ms 32 | [/build/target/app:72] (cap): 600.34 ms 33 | [/build/target/app:72] setup: 1,613.00 ms 34 | [/build/target/app:72] (typeflow): 52,133.25 ms 35 | [/build/target/app:72] (objects): 15,351.00 ms 36 | [/build/target/app:72] (features): 1,445.46 ms 37 | [/build/target/app:72] analysis: 70,501.62 ms 38 | [/build/target/app:72] (clinit): 411.29 ms 39 | [/build/target/app:72] universe: 1,402.65 ms 40 | [/build/target/app:72] (parse): 2,239.76 ms 41 | [/build/target/app:72] (inline): 3,616.38 ms 42 | [/build/target/app:72] (compile): 24,625.46 ms 43 | [/build/target/app:72] compile: 31,589.31 ms 44 | [/build/target/app:72] image: 11,673.27 ms 45 | [/build/target/app:72] write: 1,273.78 ms 46 | [/build/target/app:72] [total]: 123,193.21 ms 47 | Created native image /build/target/app 48 | ``` 49 | --------------------------------------------------------------------------------