Skip to content

Commit

Permalink
updating docs and runscript
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsochat@stanford.edu>
  • Loading branch information
vsoch committed Aug 30, 2020
1 parent 6995a33 commit c7760c3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ docker build -t two-photon .
```

and then build the [Singularity recipe](singularity/Singularity) that has a custom entrypoint.
Note that this script assumes the context to be the root of the repository.

```bash
sudo singularity build two-photon.sif singularity/Singularity
```

This works by way of creating a fresh wineprefix in /tmp (where we have write) and then
starting an interactive (bash) shell for the user to issue commands. If you want
to run the container interactively without using the [singularity_rip.sh](singularity_rip.sh)
script, you can do the following:
The runscript (entrypoint) works by way of creating a fresh wineprefix in /tmp (where we have write) and then
starting an interactive (bash) shell for the user to issue commands. For example, if we don't
have data and want to interact with wine in the container:

```bash
# create profiles directory to save profiles
Expand All @@ -72,7 +72,8 @@ I could use wine to open up the .exe file:
```bash
wine /APPS/Prairie\ View/Utilities/Image-Block\ Ripping\ Utility.exe
```
to open up the Image Block Ripping Utility:

and this is the Image Block Ripping Utility:

![singularity/img/ripping-utility.png](singularity/img/ripping-utility.png)

Expand All @@ -91,7 +92,8 @@ singularity run \
two-photon.sif
```

When you are in the bash shell, you can look at the script usage:
Again when we are in the bash shell, we can prepare to run the script by first
looking at its usage:

```bash
$ /usr/bin/python3 /app/rip.py --help
Expand Down Expand Up @@ -133,5 +135,7 @@ $ /usr/bin/python3 /app/rip.py --directory /data

The above example is interactive, but you can modify this logic however needed.
For example, you can customize the runscript to accept the data folder, and run the
python3 command directly and exit. Please be careful about specifying /usr/bin/python3
python3 command directly and exit. You could also choose to add the Windows app to the
container beforehand (and then not bind it) and this will only work
if you don't require write in that folder. Finally, please be careful about specifying /usr/bin/python3
directly, as likely a python from a host environment could also be found.
14 changes: 11 additions & 3 deletions singularity/Singularity
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ from: dlab/two-photon:latest
%help
First build the docker container:
docker build -t dlab/two-photon:latest .
Then build this file:
Then build this file (assumes root as build directory):
sudo singularity build two-photon.sif Singularity

And then run the container with binds to setup wine
singularity run \
--bind "${PWD}/Prairie View":"/APPS/Prairie View/" \
--bind ${PWD}/profiles:/PROFILES \
--bind ${PWD}/overview-21:/data \
two-photon.sif
And run the rip script!
/usr/bin/python3 /app/rip.py --directory /data

%files
runscript.sh /runscript.sh
singularity/runscript.sh /runscript.sh

%runscript
/bin/bash /runscript.sh
4 changes: 3 additions & 1 deletion singularity/runscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ echo "To install Broken Sword 2.5 (download size ~700MB):"
echo " wget http://server.c-otto.de/baphometsfluch/bs25setup.zip"
echo " unzip bs25setup.zip"
echo " wine ./bs25-setup.exe"
echo "Use the Apps directory to make it install permanently."
echo
echo "To run the two-photon ripper:"
echo "/usr/bin/python3 /app/rip.py --directory /data"
cd $TEMPDIR
env WINEPREFIX="$WINEPREFIX" WINEARCH="$WINEARCH" /bin/bash

Expand Down

0 comments on commit c7760c3

Please sign in to comment.