$ cd ~/clojure_apps $ docker-compose run --rm lein repl ... nREPL server started on port 54118 on host 127.0.0.1 - nrepl://127.0.0.1:54118 REPL-y 0.3.5, nREPL 0.2.6 Clojure 1.6.0 OpenJDK 64-Bit Server VM 1.7.0_79-b14 Docs: (doc function-name-here) (find-doc "part-of-name-here") Source: (source function-name-here) Javadoc: (javadoc java-object-or-class-here) Exit: Control+D or (exit) or (quit) Results: Stored in vars *1, *2, *3, an exception in *e
$ cd ~/clojure_apps $ docker-compose run --rm lein new compojure hello-world Retrieving compojure/lein-template/0.4.2/lein-template-0.4.2.pom from clojars Retrieving compojure/lein-template/0.4.2/lein-template-0.4.2.jar from clojars Removing clojureapps_lein_run_1...
カレントディレクトリにCompojureのプロジェクトが作成されました。
$ tree hello-world/ hello-world/ ├── README.md ├── project.clj ├── resources │ └── public ├── src │ └── hello_world │ └── handler.clj └── test └── hello_world └── handler_test.clj
Ringサーバーを起動します。lein ring serverで起動するとNo X11 DISPLAY variable was setとエラーがでてしまいます。ヘッドレスなDockerなのでlein ring server-headlessで起動します。また--service-portsフラグを指定してDockerホストにポートをマップします。
$ docker-compose run --rm --service-ports lein ring server-headless ... 2015-05-16 09:42:00.573:INFO:oejs.Server:jetty-7.6.8.v20121106 2015-05-16 09:42:00.608:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:3000 Started server on port 3000
$ docker-compose run --rm --service-ports cljslein trampoline cljsbuild repl-rhino Running Rhino-based ClojureScript REPL. ... Retrieving org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar from central Retrieving org/clojure/tools.reader/0.8.16/tools.reader-0.8.16.jar from central To quit, type: :cljs/quit ClojureScript:cljs.user>