clojure / clojurescript-site

website for ClojureScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quick Start: Issues running in Official Docker Container

oxr463 opened this issue · comments

Reproduction Steps:

Recreate Project Structure Specified in Quick Start (1).

tree
.
├── deps.edn
└── src
    └── hello_world
        └── core.cljs

Launch REPL in Docker (2).

docker run -v $(pwd)/:/usr/src/hello-world -p 80:80 -it clojure /bin/bash
cd /usr/src/hello-world
clj --main cljs.main --compile hello-world.core --repl
bash: clj: command not found

Then I tried again with the tools-deps-alpine tag since it was the first in the list.

docker run -v $(pwd)/:/usr/src/hello-world -p 80:80 -it clojure;tools-deps-alpine /bin/bash
cd /usr/src/hello-world
clj --main cljs.main --compile hello-world.core --repl
Please install rlwrap for command editing or use "clojure" instead.

See also: Quantisan/docker-clojure#55

Next, I created the following Dockerfile for my project:

FROM clojure:tools-deps-alpine

ENV ALPINE_EDGE_MIRROR "http://dl-cdn.alpinelinux.org/alpine/edge/testing"
RUN echo "${ALPINE_EDGE_MIRROR}" > /etc/apk/repositories && \
    apk update && \
    apk add rlwrap

Build via docker build . -t hello-world, then run:

docker run -v $(pwd)/:/usr/src/hello-world -p 80:80 -it hello-world /bin/bash
cd /usr/src/hello-world
clj --main cljs.main --compile hello-world.core --repl
Exception in thread "main" java.io.FileNotFoundException: Could not locate cljs/main__init.class, cljs/main.clj or cljs/main.cljc on classpath.
    at clojure.lang.RT.load(RT.java:466)
    at clojure.lang.RT.load(RT.java:428)
    at clojure.core$load$fn__6824.invoke(core.clj:6126)
    at clojure.core$load.invokeStatic(core.clj:6125)
    at clojure.core$load.doInvoke(core.clj:6109)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invokeStatic(core.clj:5908)
    at clojure.core$load_one.invoke(core.clj:5903)
    at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
    at clojure.core$load_lib.invokeStatic(core.clj:5947)
    at clojure.core$load_lib.doInvoke(core.clj:5928)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$load_libs.invokeStatic(core.clj:5985)
    at clojure.core$load_libs.doInvoke(core.clj:5969)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$require.invokeStatic(core.clj:6007)
    at clojure.main$main_opt.invokeStatic(main.clj:491)
    at clojure.main$main_opt.invoke(main.clj:487)
    at clojure.main$main.invokeStatic(main.clj:598)
    at clojure.main$main.doInvoke(main.clj:561)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.lang.Var.applyTo(Var.java:705)
    at clojure.main.main(main.java:37)

I even tried the Windows instructions:

docker run -v $(pwd)/:/usr/src/hello-world -p 80:80 -it hello-world /bin/bash
cd /usr/src/hello-world
wget https://github.com/clojure/clojurescript/releases/download/r1.10.439/cljs.jar
java -cp "cljs.jar;src" cljs.main --compile hello-world.core --repl
Error: Could not find or load main class cljs.main

I'm used to using Docker, and Alpine, but I'm very new to ClojureScript; hence, this issue.

I'm pretty sure the "official" Clojure docker container is not something created by the Clojure maintainers themselves. Even so this is just outside of anything the ClojureScript team intends to support given the limited amount of time we have to spend on issues.

clj --main cljs.main --compile hello-world.core --repl
Please install rlwrap for command editing or use "clojure" instead.

As suggested by the hint, try this instead:

clojure --main cljs.main --compile hello-world.core --repl

If you still have issues, cd to the root of the tree so you're in the same directory as deps.edn.

I'm pretty sure the "official" Clojure docker container is not something created by the Clojure maintainers themselves.

Correct, "official" here does not include any involvement from the Clojure team.