Skip to content

Instantly share code, notes, and snippets.

@keesterbrugge
Forked from cellularmitosis/README.md
Created September 17, 2019 10:39
Show Gist options
  • Select an option

  • Save keesterbrugge/6ed71e8ee44c93f8be1c51b01b85cac8 to your computer and use it in GitHub Desktop.

Select an option

Save keesterbrugge/6ed71e8ee44c93f8be1c51b01b85cac8 to your computer and use it in GitHub Desktop.

Revisions

  1. @cellularmitosis cellularmitosis revised this gist Sep 2, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,10 @@
    Blog 2019/7/18

    [<- previous](https://gist.github.com/cellularmitosis/91f654aca6500eb1c8408768486e19b8) |
    [index](https://gist.github.com/cellularmitosis/1106b185f8b34ae0e36afa5fbcd04a00) |
    [next ->](https://gist.github.com/cellularmitosis/5c1011b4199bfb3920ad9b06dbf2277f)

    # Blog 2019/7/18: "Hello, world" in Clojure compiled with GraalVM running in Docker
    # "Hello, world" in Clojure compiled with GraalVM running in Docker

    Create a new minimal Clojure project using leiningen:

  2. @cellularmitosis cellularmitosis revised this gist Sep 2, 2019. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,8 @@
    # "Hello, world" in Clojure compiled with GraalVM running in Docker
    [<- previous](https://gist.github.com/cellularmitosis/91f654aca6500eb1c8408768486e19b8) |
    [index](https://gist.github.com/cellularmitosis/1106b185f8b34ae0e36afa5fbcd04a00) |
    [next ->](https://gist.github.com/cellularmitosis/5c1011b4199bfb3920ad9b06dbf2277f)

    # Blog 2019/7/18: "Hello, world" in Clojure compiled with GraalVM running in Docker

    Create a new minimal Clojure project using leiningen:

  3. @cellularmitosis cellularmitosis revised this gist Jul 18, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # "Hello, world" in Clojure compiled with GrallVM running in Docker
    # "Hello, world" in Clojure compiled with GraalVM running in Docker

    Create a new minimal Clojure project using leiningen:

  4. @cellularmitosis cellularmitosis created this gist Jul 18, 2019.
    59 changes: 59 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    # "Hello, world" in Clojure compiled with GrallVM running in Docker

    Create a new minimal Clojure project using leiningen:

    ```
    $ lein new minimal hello
    $ cd hello
    ```

    Edit `project.clj` to look like this:

    ```clojure
    (defproject hello "0.1.0-SNAPSHOT"
    :dependencies [[org.clojure/clojure "1.10.0"]]
    :profiles {:dev {:dependencies [[org.clojure/test.check "0.9.0"]]}} :main hello.core)
    ```

    Edit `src/hello/core.clj` to look like this:

    ```clojure
    (ns hello.core
    (:gen-class))

    (defn -main []
    (println "Hello, clombda!"))
    ```

    According to [this](https://github.com/uwcpdx/clombda/blob/master/README.md) you also need to run this:

    ```
    $ lein change :main set hello.core
    ```

    Build a native image:

    ```
    $ docker run --rm "-v$(pwd):/clj" "-v${HOME}/.m2:/root/.m2" spieden/clombda:latest
    ```

    Create a Dockerfile:

    ```
    FROM renanpalmeira/graalvm-alpine
    COPY target/clombda/package/clj-native /root/
    CMD ["/root/clj-native"]
    ```

    Build a docker image:

    ```
    $ docker build -t hello .
    ```

    Run it:

    ```
    $ docker run hello
    Hello, clombda!
    ```