mirror of
https://github.com/Shawn-Shan/fawkes.git
synced 2024-12-22 07:09:33 +05:30
Add Dockerfile
This commit is contained in:
parent
022a8ed549
commit
c8fd67dcbe
24
Dockerfile
24
Dockerfile
@ -1,14 +1,16 @@
|
|||||||
# set base image
|
|
||||||
FROM python:3.7-slim
|
FROM python:3.7-slim
|
||||||
|
|
||||||
# set the working directory in the container
|
ENV PATH="~/.local/bin:${PATH}"
|
||||||
WORKDIR /app
|
ENV PATH="/home/testuser/.local/bin:${PATH}"
|
||||||
|
|
||||||
# install fawkes
|
#Mirror host user
|
||||||
RUN pip install fawkes
|
#Efficently mirror host user and share files between host and docker
|
||||||
|
#https://stackoverflow.com/a/44683248/298240
|
||||||
# downgrade h5py: https://github.com/Shawn-Shan/fawkes/issues/75
|
ARG UNAME=testuser
|
||||||
RUN pip install --upgrade h5py==2.10.0
|
ARG UID=1000
|
||||||
|
ARG GID=1000
|
||||||
# copy the files you want to edit with fawkes
|
#FIXES https://stackoverflow.com/a/63377623/298240
|
||||||
COPY imgs imgs
|
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
|
||||||
|
13
README.md
13
README.md
@ -64,15 +64,14 @@ If you don't have root privilege, please try to install on user namespace: `pip
|
|||||||
|
|
||||||
## Installation and Usage with Docker
|
## Installation and Usage with Docker
|
||||||
|
|
||||||
- clone this repository: `git clone [url]`
|
- 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`
|
- go into cloned repository: `cd fawkes`
|
||||||
- create `/imgs` folder in root folder: `mkdir imgs`
|
- run `buildDocker.sh`
|
||||||
- build docker image in root folder: `docker build -t fawkes .`
|
- run `startDocker.sh`
|
||||||
- run container: `docker run -it fawkes sh`
|
- You should now be in the fawkes container with your normal workspace directory to /home/testuser/workspace
|
||||||
- run your fawkes command, e.g. `fawkes -d ./imgs --mode min`
|
- You can then run fawkes with something like: e.g. `fawkes -d ./imgs --mode=low`
|
||||||
- exit from your container: `exit`
|
- exit from your container: `exit`
|
||||||
- find your container id: `docker container ls --all`
|
|
||||||
- copy the created data to your local machine: `docker cp [container-id]:/app/imgs ~/output-from-fawkes`
|
|
||||||
|
|
||||||
Academic Research Usage
|
Academic Research Usage
|
||||||
-----------------------
|
-----------------------
|
||||||
|
5
buildDocker.sh
Executable file
5
buildDocker.sh
Executable file
@ -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 .
|
2
startDocker.sh
Executable file
2
startDocker.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#Map Parrent directory to workspace folder under home directory
|
||||||
|
docker run -it -v "$(pwd)/..:/home/testuser/workspace" fawkes bash
|
Loading…
Reference in New Issue
Block a user