在Docker容器中运行应用程序时找不到clojure.main

时间:2020-04-08 14:41:56

标签: docker heroku clojure

我的clojure + clojurescript项目中有以下Dockerfile:

# We will use Ubuntu for our image
FROM ubuntu:latest

# Updating Ubuntu packages

ARG CLOJURE_TOOLS_VERSION=1.10.1.507


RUN apt-get -qq update && apt-get -qq -y install curl wget bzip2 openjdk-8-jdk-headless \
    && curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \
    && bash /tmp/miniconda.sh -bfp /usr/local \
    && rm -rf /tmp/miniconda.sh \
    && conda install -y python=3 \
    && conda update conda \
    && curl -o install-clojure https://download.clojure.org/install/linux-install-${CLOJURE_TOOLS_VERSION}.sh \
    && chmod +x install-clojure \
    && ./install-clojure && rm install-clojure \
    && wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein \
    && chmod a+x lein \
    && mv lein /usr/bin \
    && apt-get -qq -y autoremove \
    && apt-get autoclean \
    && rm -rf /var/lib/apt/lists/* /var/log/dpkg.log \
    && conda clean --all --yes


ENV PATH /opt/conda/bin:$PATH

RUN conda create -n pyclj python=3.6 && conda install -n pyclj numpy mxnet

## To install pip packages into the pyclj environment do
RUN conda run -n pyclj python3 -mpip install numpy

RUN java $JVM_OPTS -cp target/myapp.jar clojure.main -m myapp.application

但是当我将其推送到heroku并尝试转到我的应用程序时,出现错误:

“找不到clojure.main。”

当我尝试在本地构建和运行此容器时,出现相同的错误。 我在做什么错,该如何解决?

-编辑--


(ns myapp.application
  (:gen-class)
  (:require [com.stuartsierra.component :as component]
            [myapp.components.server-info :refer [server-info]]
            [system.components.endpoint :refer [new-endpoint]]
            [system.components.handler :refer [new-handler]]
            [system.components.middleware :refer [new-middleware]]
            [system.components.aleph :refer [new-web-server]]
            [myapp.config :refer [config]]
            [myapp.routes :refer [home-routes]]))

(defn app-system [config]
  (component/system-map
   :routes     (new-endpoint home-routes)
   :middleware (new-middleware {:middleware (:middleware config)})
   :handler    (-> (new-handler :router :bidi
                    )
                   (component/using [:routes :middleware]))
   :http       (-> (new-web-server (:http-port config) :handler)
                   (component/using [:handler]))
   :server-info (server-info (:http-port config))))

(defn -main [& _]
  (let [config (config)]
    (-> config
        app-system
        component/start)))

0 个答案:

没有答案