diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3186d66 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.7-slim + +ENV PATH="~/.local/bin:${PATH}" +ENV PATH="/home/testuser/.local/bin:${PATH}" + +#Mirror host user +#Efficently mirror host user and share files between host and docker +#https://stackoverflow.com/a/44683248/298240 +ARG UNAME=testuser +ARG UID=1000 +ARG GID=1000 +#FIXES https://stackoverflow.com/a/63377623/298240 +RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 python3-opencv sudo && groupadd -g $GID -o $UNAME && useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME && echo "testuser:testuser" | chpasswd && adduser testuser sudo +USER $UNAME +WORKDIR /home/$UNAME/workspace +RUN pip install --upgrade h5py==2.10.0 fawkes opencv-python diff --git a/README.md b/README.md index 456bfbe..bf91ad4 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,16 @@ pip install fawkes If you don't have root privilege, please try to install on user namespace: `pip install --user fawkes`. +## Installation and Usage with Docker + +- On your host machine move or copy your images folder to your normal workspace directory `cd ~/workspace` +- clone this repository: `git clone [url]` into your normal workspace directory +- go into cloned repository: `cd fawkes` +- run `buildDocker.sh` +- run `startDocker.sh` +- You should now be in the fawkes container with your normal workspace directory to /home/testuser/workspace +- You can then run fawkes with something like: e.g. `fawkes -d ./imgs --mode=low` +- exit from your container: `exit` Academic Research Usage ----------------------- diff --git a/buildDocker.sh b/buildDocker.sh new file mode 100755 index 0000000..29dd6b6 --- /dev/null +++ b/buildDocker.sh @@ -0,0 +1,5 @@ +#Pass in user id's for mirroring host user +docker build \ + --build-arg UID=$(id -u) \ + --build-arg GID=$(id -g) \ + -t fawkes . diff --git a/startDocker.sh b/startDocker.sh new file mode 100755 index 0000000..3067162 --- /dev/null +++ b/startDocker.sh @@ -0,0 +1,2 @@ +#Map Parrent directory to workspace folder under home directory +docker run -it -v "$(pwd)/..:/home/testuser/workspace" fawkes bash