-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingularity_template.def
65 lines (50 loc) · 2.05 KB
/
singularity_template.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
BootStrap: docker
From: fedora:35
### Change <YOU>/MyPackage.jl to the appropriate settings for you BEFORE you run this.
%post
dnf install -y wget openssh-clients git
## We'll install in /opt
cd /opt
## Get your packages cloned (with a git repo, not zip)
git clone https://github.com/<YOU>/MyPackage.jl
## Get latest Julia
wget https://julialang-s3.julialang.org/bin/linux/x64/1.7/julia-1.7.1-linux-x86_64.tar.gz
mkdir -p /opt/julia
mv julia-1.7.1-linux-x86_64.tar.gz /opt/julia
cd /opt/julia
tar -xf julia-1.7.1-linux-x86_64.tar.gz
## Make sure PATH is set correctly
export PATH=/opt/julia/julia-1.7.1/bin:$PATH
## Isolate Julia to use within container directories, do not leak to ~/.julia if we can avoid it
mkdir -p /opt/juliadepot
export JULIA_DEPOT_PATH=/opt/juliadepot
## Configure our own package
cd /opt/MyPackage.jl
# Install (note that --project=X is the same as Pkg.activate(X))
julia --project=/opt/MyPackage.jl -e 'using Pkg; Pkg.update(); Pkg.instantiate()'
# Force precompile
julia --project=/opt/MyPackage.jl -e 'using MyPackage'
# Not needed
julia --project=/opt/MyPackage.jl -e 'using Pkg; Pkg.build("MyPackage")'
# Make sure what we build still works, if the tests fail, the build will fail.
julia --project=/opt/MyPackage.jl -e 'using Pkg; Pkg.test("MyPackage")'
## Interactive Julia will write to logs, but we don't want
## the container to be writable, so link it to tmpfs on host.
rm -rf /opt/juliadepot/logs
ln -s /dev/shm/ /opt/juliadepot/logs
# Get rid of the packages not needed for runtime
dnf remove -y wget openssh-clients git
%environment
export LC_ALL=C
export PATH=/opt/julia/julia-1.7.1/bin:$PATH
export JULIA_DEPOT_PATH=/opt/juliadepot
%runscript
echo "Container was created $NOW"
echo "Arguments received: $*"
echo pwd
exec echo "$@"
%labels
Author [email protected]
Version v0.4.2
%help
singularity exec image.sif julia --project=/opt/MyPackage.jl