-
Notifications
You must be signed in to change notification settings - Fork 0
/
apptainer.def
59 lines (47 loc) · 1.48 KB
/
apptainer.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
Bootstrap: docker
From: ubuntu:22.04
%files
environment.yml /opt/environment.yml
%environment
export PATH="/opt/mambaforge/bin:$PATH"
export PYTHONNOUSERSITE=1
%post
# Install necessary system packages
apt-get update && apt-get install -y --no-install-recommends \
git \
nano \
wget \
curl \
ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Mambaforge
cd /tmp
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-$(uname)-$(uname -m).sh -fp /opt/mambaforge -b
rm Mambaforge*sh
export PATH=/opt/mambaforge/bin:$PATH
# Activate mamba and create the environment
. /opt/mambaforge/etc/profile.d/conda.sh
mamba env create -f /opt/environment.yml
# Clean up conda packages to reduce the container size
mamba clean -a --yes
%runscript
. /opt/mambaforge/etc/profile.d/conda.sh
conda activate dronalize
exec "$@"
%help
This is a container for the Dronalize project. It contains all the necessary dependencies to run the project.
To run the project, you can use the following command:
```
apptainer run dronalize.sif <command> <args>
```
where `<command>` is the command you want to run and `<args>` are the arguments for the command.
For example, to run the train script, you can use the following command:
```
apptainer run dronalize.sif python train.py
```
To enable GPU support, you can use the following command:
```
apptainer run --nv dronalize.sif python train.py
```