I’m trying to transition a web-server project I wrote to a package so that I can use packagecompiler.jl to precompile it and reduce startup latency. I would like to test the package precompiliation locally in a docker container. However, I’m getting stuck at adding the package.
If I do
pkgPath = joinpath(@__DIR__, "CCG_Server")
union!(LOAD_PATH, [pkgPath])
using CCG_Server
CCG_Server.SERVER_ENV
Everything works as expected (although it takes a while to precompile) and it displays the local constant SERVER_ENV. However, if I rebuild the docker container and do
import Pkg
import Pkg.PackageSpec
pkgPath = joinpath(@__DIR__, "CCG_Server")
Pkg.add(PackageSpec(path=pkgPath))
using CCG_Server
CCG_Server.SERVER_ENV
The package loading is suspiciously fast and when all is done, it says that “UndefVarError: SERVER_ENV not defined”. In fact NONE of the functions in CCG_Server exist. It seems like it’s only a recursive field
names(CCG_Server.CCG_Server.CCG_Server.CCG_Server.CCG_Server)
1-element Vector{Symbol}:
:CCG_Server
What happened? I have the Project.toml file set up with the deps and everything. Is there something I’m missing?