Enhanced Makefile runscript and simplified using pre-built images
This commit is contained in:
parent
a8ca4ba9eb
commit
102b065fab
20
Makefile
20
Makefile
|
@ -21,13 +21,21 @@ p4iab.sif: p4iab.def p4iab.tar.gz
|
||||||
sudo "$(SINGULARITY)" build "$@" "$<"
|
sudo "$(SINGULARITY)" build "$@" "$<"
|
||||||
sudo chown $(UID):$(GID) "$@"
|
sudo chown $(UID):$(GID) "$@"
|
||||||
|
|
||||||
run: .docker_build
|
run:
|
||||||
mkdir -p "$(SHARED_DIR)"
|
@mkdir -p "$(SHARED_DIR)"
|
||||||
"$(DOCKER)" run --rm -it --privileged -v "$(SHARED_DIR):/home/p4/shared" -e TERM -u p4 --entrypoint p4iab_docker_entry.sh p4iab:latest
|
@test -n "$(shell docker image ls -q p4iab)" \
|
||||||
|
|| (echo Cannot find image p4iab:latest, has it been built yet? \
|
||||||
|
&& false)
|
||||||
|
@"$(DOCKER)" run --rm -it --privileged -v "$(SHARED_DIR):/home/p4/shared" \
|
||||||
|
-e TERM -u p4 --entrypoint p4iab_docker_entry.sh p4iab:latest
|
||||||
|
|
||||||
sc-run: p4iab.sif
|
sc-run:
|
||||||
mkdir -p "$(SHARED_DIR)" "$(OVERLAY_DIR)"
|
@mkdir -p "$(SHARED_DIR)" "$(OVERLAY_DIR)"
|
||||||
sudo singularity run --allow-setuid --overlay "$(OVERLAY_DIR)" -B "$(SHARED_DIR):/home/p4/shared" "$<"
|
@test -e p4iab.sif \
|
||||||
|
|| (echo Cannot find p4iab.sif, has it been built yet? \
|
||||||
|
&& false)
|
||||||
|
@sudo singularity run --allow-setuid --overlay "$(OVERLAY_DIR)" \
|
||||||
|
-B "$(SHARED_DIR):/home/p4/shared" p4iab.sif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
"$(DOCKER)" container prune
|
"$(DOCKER)" container prune
|
||||||
|
|
20
README.md
20
README.md
|
@ -45,15 +45,11 @@ instructions below.
|
||||||
|
|
||||||
To use P4-in-a-Bottle with Singularity:
|
To use P4-in-a-Bottle with Singularity:
|
||||||
1. Install singularity from [GitHub](https://github.com/sylabs/singularity/releases).
|
1. Install singularity from [GitHub](https://github.com/sylabs/singularity/releases).
|
||||||
2. Clone and enter this repository.
|
2. Clone and cd into this repository.
|
||||||
3. Download a pre-built image
|
3. Download a pre-built image
|
||||||
[p4iab.sif](https://git.inkweaver.net/inkweaver/P4-in-a-Bottle/releases)
|
[p4iab.sif](https://git.inkweaver.net/inkweaver/P4-in-a-Bottle/releases)
|
||||||
and place it in the same directory alongside `README.md`.
|
and place it in the same directory alongside `README.md`.
|
||||||
4. Run `touch .docker_build p4iab.tar.gz p4iab.sif`. This prevents make from
|
4. Run `make sc-run`. A shared directory `shared/` will be created to allow
|
||||||
building the container from source. If you skip this step YOU WILL BUILD
|
|
||||||
BOTH THE DOCKER CONTAINER AND THE SINGULARITY CONTAINER FROM SOURCE. (Trust
|
|
||||||
me, you do NOT want to build this yourself).
|
|
||||||
5. Run `make sc-run`. A shared directory `shared/` will be created to allow
|
|
||||||
you to move files between the container and your system.
|
you to move files between the container and your system.
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
@ -61,14 +57,11 @@ To use P4-in-a-Bottle with Singularity:
|
||||||
If you are stuck with docker, don't panic! The instructions are longer but
|
If you are stuck with docker, don't panic! The instructions are longer but
|
||||||
everything should still work.
|
everything should still work.
|
||||||
1. Install docker on your system. This should be pretty self-explanatory.
|
1. Install docker on your system. This should be pretty self-explanatory.
|
||||||
2. Clone and enter this repository.
|
2. Clone and cd into this repository.
|
||||||
3. Download a pre-built image
|
3. Download a pre-built image
|
||||||
[p4iab.tar.gz](https://git.inkweaver.net/inkweaver/P4-in-a-Bottle/releases)
|
[p4iab.tar.gz](https://git.inkweaver.net/inkweaver/P4-in-a-Bottle/releases)
|
||||||
and place it in the same directory alongside `README.md`. Then run
|
and place it in the same directory alongside `README.md`.
|
||||||
`docker load -i p4iab.tar.gz` to import the container into docker.
|
4. Run `docker load -i p4iab.tar.gz` to import the container into docker.
|
||||||
4. Run `touch .docker_build`. This tricks make into skipping the docker build
|
|
||||||
commands. If you skip this step YOU WILL BUILD THE DOCKER CONTAINER FROM
|
|
||||||
SOURCE. Do so only if you know what you are doing.
|
|
||||||
5. Run `make run`. A shared directory `shared/` will be created to allow
|
5. Run `make run`. A shared directory `shared/` will be created to allow
|
||||||
you to move files between the container and your system.
|
you to move files between the container and your system.
|
||||||
|
|
||||||
|
@ -95,3 +88,6 @@ $ make p4iab.sif
|
||||||
$ make clean
|
$ make clean
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Once you have either `p4iab.tar.gz` or `p4iab.sif`, proceed to follow the
|
||||||
|
instructions in the "How to Use" section from step 4.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue