我有一个Dockerfile,它安装Julia和一些依赖项,然后调用一个脚本。脚本的第1行是“使用JSServe”,应该安装。
# Runs ubuntu commands
FROM ubuntu
# Install wget and other
RUN apt-get update && \
apt-get install -y wget && \
apt-get install -y tar
# Downloads and install julia
ENV JULIA_NAME "julia-1.9.0-beta2-linux-x86_64.tar.gz"
RUN wget https://julialang-s3.julialang.org/bin/linux/x64/1.9/${JULIA_NAME} && \
tar -xvzf ${JULIA_NAME} && \
mv julia-1.9.0-beta2 /opt/ && \
ln -s /opt/julia-1.9.0-beta2/bin/julia /usr/local/bin/julia && \
rm ${JULIA_NAME}
# Copy files
COPY Project.toml ./Project.toml
COPY JSServe_app.jl ./JSServe_app.jl
# Install deps
RUN julia --project -e "import Pkg; Pkg.instantiate(); Pkg.precompile()"
# Run apps
CMD julia --project -e 'include("JSServe_app.jl")'
这在本地运行得很好,但是在远程服务器(Heroku)上,我得到了以下错误:
Starting process with command `/bin/sh -c julia\ -e\ \'include\(\"JSServe_app.jl\"\)\'`
ERROR: LoadError: ArgumentError: Package JSServe not found in current path.
我不明白为什么要安装JSServe- Docker构建可以在本地运行。所有文件都可以在GitHub https://github.com/AlexisRenchon/app-wglmakie-fig上看到
我试着在我的Docker映像中安装依赖项,它在本地工作,但在Heroku远程服务器上不工作。
编辑:看起来问题是安装的软件包被删除了...
2023-01-31T14:38:11.444805+00:00 heroku[web.1]: Starting process with command `/bin/sh -c julia\ --project\=.\ -e\ \"import\ Pkg\;\ Pkg.status\(\)\"`
2023-01-31T14:38:13.572537+00:00 app[web.1]: Installing known registries into `~/.julia`
2023-01-31T14:38:17.410042+00:00 heroku[web.1]: Process exited with status 0
2023-01-31T14:38:17.466348+00:00 heroku[web.1]: State changed from starting to crashed
2023-01-31T14:38:17.176302+00:00 app[web.1]: Status `~/Project.toml`
2023-01-31T14:38:17.212226+00:00 app[web.1]: → [824d6782] JSServe v2.1.0
2023-01-31T14:38:17.212346+00:00 app[web.1]: → [276b4fcb] WGLMakie v0.8.6
2023-01-31T14:38:17.212445+00:00 app[web.1]: Info Packages marked with → are not downloaded, use `instantiate` to download
2条答案
按热度按时间wvt8vs2t1#
我认为您忽略了
--project=.
,请注意=.
tkclm6bt2#
好吧,我让它工作: