skip to Main Content

I have a Dockerfile that installs Julia and some dependencies, then call a script.
The 1st line of the script is "using JSServe" which should be installed.

# 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")'

This works perfectly locally.
But on a remote server (Heroku), I get the following error:

Starting process with command `/bin/sh -c julia -e 'include("JSServe_app.jl")'` 
ERROR: LoadError: ArgumentError: Package JSServe not found in current path.

I don’t understand why… JSServe should be installed – Docker build does work locally.
All files can be seen on GitHub https://github.com/AlexisRenchon/app-wglmakie-fig

I tried to install the dependencies in my Docker image, it worked locally, but not on the Heroku remote server.

EDIT:
looks like the problem is packages installed are removed somehow…

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

Answers


  1. Chosen as BEST ANSWER

    Ok I got it to work:

    # 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}
    
    ENV mainpath ./
    RUN mkdir -p ${mainpath}
    
    USER ${NB_USER}
    
    ENV USER_HOME_DIR /home/${NB_USER}
    ENV JULIA_PROJECT ${USER_HOME_DIR}
    ENV JULIA_DEPOT_PATH ${USER_HOME_DIR}/.julia
    
    # Copy files
    COPY Project.toml ${mainpath}/Project.toml 
    COPY JSServe_app.jl ${mainpath}/JSServe_app.jl
    
    # Install deps
    RUN julia --project=${mainpath} -e "import Pkg; Pkg.instantiate(); Pkg.precompile()"
    
    # Run apps
    CMD julia --project=${mainpath} -e 'include("JSServe_app.jl")'
    

  2. I think you’re missing the --project=., notice the =.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search