Iâm also working on bioinformatics tools, and I would like to be able to containerize them with singularity.
For the moment, I have only written one tool with Julia, it works on my local workstation, but it is still very unclear to me how such things should be organized and distributed.
For my container, I start with an official docker image that provides Julia. My current issue is how to get the dependencies of my project. Here is what I tried:
Bootstrap:docker
From:julia:1.2-buster
%post
apt-get update -y
apt-get install -y git
mkdir -p /usr/local/src
cd /usr/local/src
git clone https://qaf_demux:KU13FfM3kLyeCrWpD2ZG@gitlab.pasteur.fr/bli/qaf_demux.git
cd qaf_demux/Julia/QafDemux/
/usr/local/julia/bin/julia --project=. --eval 'import Pkg; Pkg.instantiate()'
apt-get remove -y git
apt-get autoremove -y
apt-get clean -y
%environment
export LC_ALL=C
export PATH=/usr/local/src/qaf_demux/Julia/QafDemux/bin:"${PATH}"
%runscript
exec /usr/local/src/qaf_demux/Julia/QafDemux/bin/qaf_demux.sh "$@"
The build crashes as follows:
+ cd qaf_demux/Julia/QafDemux/
+ /usr/local/julia/bin/julia --project=. --eval import Pkg; Pkg.instantiate()
Cloning default registries into `~/.julia`
Cloning registry from "https://github.com/JuliaRegistries/General.git"
Added registry `General` to `~/.julia/registries/General`
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
ERROR: Package FASTX [c2308a5c-f048-11e8-3e8a-31650f418d12] not found in a registry.
Stacktrace:
[1] pkgerror(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/Types.jl:112
[2] check_registered(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/Operations.jl:924
[3] up(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Pkg.Types.UpgradeLevel) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/Operations.jl:1043
[4] #up#43(::Pkg.Types.UpgradeLevel, ::Pkg.Types.PackageMode, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(Pkg.API.up), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/API.jl:167
[5] #up#38 at ./none:0 [inlined]
[6] #up at ./none:0 [inlined]
[7] #instantiate#81(::Nothing, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(Pkg.API.instantiate), ::Pkg.Types.Context) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/API.jl:463
[8] instantiate at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/API.jl:461 [inlined]
[9] #instantiate#80 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/API.jl:458 [inlined]
[10] instantiate() at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.2/Pkg/src/API.jl:458
[11] top-level scope at none:1
FATAL: failed to execute %post proc: exit status 1
FATAL: While performing build: while running engine: exit status 255
If I simply run the original image, as non-root user, it seems that there is no problem finding the required packages:
$ singularity shell docker://julia:1.2-buster
Singularity julia_1.2-buster.sif:~/src/qaf_demux/Julia/QafDemux> cd tmp/qaf_demux/Julia/QafDemux/
Singularity julia_1.2-buster.sif:~/src/qaf_demux/Julia/QafDemux/tmp/qaf_demux/Julia/QafDemux> julia --project=. --eval 'import Pkg; Pkg.instantiate()'
Updating registry at `~/.julia/registries/BioJuliaRegistry`
Updating git-repo `https://github.com/BioJulia/BioJuliaRegistry.git`
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `~/src/qaf_demux/Julia/QafDemux/tmp/qaf_demux/Julia/QafDemux/Project.toml`
[c7e460c6] + ArgParse v0.6.2
[944b1d66] + CodecZlib v0.6.0
[e30172f5] + Documenter v0.23.3
[c2308a5c] + FASTX v1.1.0
[c8e1da08] + IterTools v1.2.0
[3bb67fe8] + TranscodingStreams v0.9.5
[44cfe95a] + Pkg
Updating `~/src/qaf_demux/Julia/QafDemux/tmp/qaf_demux/Julia/QafDemux/Manifest.toml`
[c7e460c6] + ArgParse v0.6.2
[67c07d97] + Automa v0.7.0
[b99e7846] + BinaryProvider v0.5.6
[47718e42] + BioGenerics v0.1.0
[7e6ae17a] + BioSequences v2.0.0
[3c28c6f8] + BioSymbols v4.0.1
[944b1d66] + CodecZlib v0.6.0
[861a8166] + Combinatorics v0.7.0
[34da2185] + Compat v2.1.0
[864edb3b] + DataStructures v0.17.0
[ffbed154] + DocStringExtensions v0.8.0
[e30172f5] + Documenter v0.23.3
[c2308a5c] + FASTX v1.1.0
[1cb3b9ac] + IndexableBitVectors v1.0.0
[c8e1da08] + IterTools v1.2.0
[682c06a0] + JSON v0.21.0
[bac558e1] + OrderedCollections v1.1.0
[69de0a69] + Parsers v0.3.7
[f27b6e38] + Polynomials v0.5.2
[b718987f] + TextWrap v0.3.0
[3bb67fe8] + TranscodingStreams v0.9.5
[7200193e] + Twiddle v1.1.1
[2a0f44e3] + Base64
[ade2ca70] + Dates
[8bb1440f] + DelimitedFiles
[8ba89e20] + Distributed
[b77e0a4c] + InteractiveUtils
[76f85450] + LibGit2
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[56ddb016] + Logging
[d6f4376e] + Markdown
[a63ad114] + Mmap
[44cfe95a] + Pkg
[de0858da] + Printf
[3fa0cd96] + REPL
[9a3f8284] + Random
[ea8e919c] + SHA
[9e88b42a] + Serialization
[1a1011a3] + SharedArrays
[6462fe0b] + Sockets
[2f01184e] + SparseArrays
[10745b16] + Statistics
[8dfed614] + Test
[cf7118a7] + UUIDs
[4ec0a83e] + Unicode
If I try similar thing as root, then the same failure to find package FASTX happens as in the %post phase of the custom image build.