Removed Docker requirement for building SIF file
This commit is contained in:
parent
65ffd4fd25
commit
fee3beac4f
4 changed files with 95 additions and 131 deletions
36
Makefile
36
Makefile
|
@ -1,44 +1,22 @@
|
|||
DOCKER ?= docker
|
||||
APPTAINER ?= apptainer
|
||||
OVERLAY_DIR ?= ./overlay
|
||||
SHARED_DIR ?= ./shared
|
||||
MAX_THREADS ?= $(shell grep -c processor /proc/cpuinfo)
|
||||
NUM_THREADS ?= $(shell grep -c processor /proc/cpuinfo)
|
||||
|
||||
UID := $(shell id -u)
|
||||
GID := $(shell id -g)
|
||||
|
||||
.DEFAULT_GOAL := .docker_build
|
||||
.DEFAULT_GOAL := mobileinsight.sif
|
||||
|
||||
.docker_build: Dockerfile
|
||||
"$(DOCKER)" build --build-arg "MAX_THREADS=$(MAX_THREADS)" -t mobileinsight .
|
||||
touch "$@"
|
||||
mobileinsight.sif: mobileinsight.def
|
||||
"$(APPTAINER)" build --build-arg="NUM_THREADS=$(NUM_THREADS)" "$@" "$<"
|
||||
|
||||
mobileinsight.tar.gz: .docker_build
|
||||
"$(DOCKER)" save mobileinsight:latest | gzip > "$@"
|
||||
|
||||
mobileinsight.sif: mobileinsight.def .docker_build
|
||||
"$(APPTAINER)" build "$@" "$<"
|
||||
|
||||
run: .docker_build
|
||||
@mkdir -p "$(SHARED_DIR)"
|
||||
@test -n "$(shell docker image ls -q mobileinsight)" \
|
||||
|| (echo Cannot find image mobileinsight:latest, has it been built yet? 1>&2 \
|
||||
&& false)
|
||||
@"$(DOCKER)" run --rm -it --privileged -v "$(SHARED_DIR):/mnt" \
|
||||
-e TERM -u root --entrypoint bash mobileinsight:latest
|
||||
|
||||
app-run: mobileinsight.sif
|
||||
run: mobileinsight.sif
|
||||
@mkdir -p "$(OVERLAY_DIR)"
|
||||
@lsmod | grep overlay > /dev/null || sudo modprobe overlay
|
||||
@$(APPTAINER) run --overlay "$(OVERLAY_DIR)" \
|
||||
-B "/run/user/$(UID)" mobileinsight.sif
|
||||
|
||||
clean:
|
||||
"$(DOCKER)" container prune
|
||||
"$(DOCKER)" image prune -a
|
||||
rm -f .docker_build mobileinsight.tar.gz mobileinsight.sif
|
||||
rm -f mobileinsight.sif $(OVERLAY_DIR)
|
||||
|
||||
clean-data:
|
||||
rm -rf $(OVERLAY_DIR) $(SHARED_DIR)
|
||||
|
||||
.PHONY: sc-run run clean clean-data
|
||||
.PHONY: run clean
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue