-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
37 lines (32 loc) · 956 Bytes
/
Makefile
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
.PHONY : all clean
SHELL:=/usr/bin/env bash
CONT_NAME ?= rockylinux
# Usage: $ make [CONT_NAME=<rockylinux8|ubuntu20.04|etc>] [clean]
all: $(CONT_NAME)/$(CONT_NAME).sif
# Build container given proper .def file
%.sif: %.def
$(eval TMP_DIR=$(shell mktemp -d -p /tmp))
@echo $(TMP_DIR)
@cp $< $(TMP_DIR)
@echo "=================="
@echo "Building container"
@echo "=================="
# Building in /tmp is a workaround for builds failing while in
# /gscratch/<account>/
APPTAINER_BIND="" \
SINGULARITY_BIND="" \
APPTAINER_BINDPATH="" \
SINGULARITY_BINDPATH="" \
apptainer build \
--fakeroot \
$(TMP_DIR)/$(CONT_NAME).sif \
$(TMP_DIR)/$(CONT_NAME).def
@if [ -f $(TMP_DIR)/$(CONT_NAME).sif ]; then \
mv $(TMP_DIR)/$(CONT_NAME).sif $@; \
echo "==========================="; \
echo "Finished building container"; \
echo "==========================="; \
fi
rm -rf $(TMP_DIR)
clean:
@rm -rf $(CONT_NAME)/$(CONT_NAME).sif