-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
29 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,9 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y git python3 graphviz python3-pip ssh mercurial python-setuptools zip | ||
|
||
RUN python3 -m pip install --upgrade pip && \ | ||
pip3 install rdflib requests rapidfuzz fuzzywuzzy pygithub pybids duecredit setuptools \ | ||
python-Levenshtein pytest graphviz prov pydot validators ontquery \ | ||
click rdflib-jsonld pyld pytest-cov tabulate joblib | ||
|
||
|
||
|
||
FROM python:3.11 | ||
RUN apt-get update && apt-get install -y graphviz | ||
WORKDIR /opt | ||
|
||
RUN wget https://files.pythonhosted.org/packages/af/1c/7e4c25d5539ac8979d633afe03d16ddb01716c6cde97ebea33a6659ea9c6/Owlready2-0.24.tar.gz&& \ | ||
tar -xzf Owlready2-0.24.tar.gz && \ | ||
cd Owlready2-0.24 && \ | ||
python setup.py build && \ | ||
python setup.py install | ||
|
||
ENV LC_ALL=C.UTF-8 | ||
ENV LANG=C.UTF-8 | ||
RUN update-alternatives --remove python /usr/bin/python2 && \ | ||
update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && \ | ||
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10 | ||
|
||
RUN cd / && \ | ||
git clone https://github.com/incf-nidash/PyNIDM.git && \ | ||
mv PyNIDM PyNIDM-snapshot && \ | ||
cd PyNIDM-snapshot && \ | ||
pip install -e . | ||
|
||
RUN git config --global user.name "docker user" && git config --global user.email "[email protected]" | ||
|
||
ENV TMPDIR=/opt/project/cache | ||
|
||
COPY . . | ||
RUN pip install git+https://github.com/incf-nidash/PyNIDM.git | ||
RUN git config --global user.name "docker user" && \ | ||
git config --global user.email "[email protected]" | ||
CMD ["/bin/bash"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
FROM pynidm:latest | ||
|
||
RUN pip3 install flask flask_restful flask-cors | ||
|
||
RUN pip install flask flask_restful flask-cors | ||
EXPOSE 5000 | ||
CMD ["python", "/opt/project/rest-server.py"] | ||
COPY rest-server.py /usr/src/ | ||
CMD ["python", "/usr/src/rest-server.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,47 @@ | ||
# Docker and REST API | ||
|
||
This dockerfile can be used to create a development docker container suitable for both | ||
interactive use and also as a proof of concept REST API server. | ||
This Dockerfile can be used to create a development Docker container suitable | ||
for both interactive use and also as a proof-of-concept REST API server. | ||
|
||
#Build the container | ||
## Build the container | ||
|
||
These instructions assume you have the PyNIDM source code in ~/PyNIDM. | ||
To build the container, start in this directory and use the command: | ||
To build the container, start in this directory and run the commands: | ||
|
||
``` | ||
./build.sh | ||
docker build -f Dockerfile -t pynidm . | ||
docker build -f Dockerfile-rest -t pynidm-rest . | ||
``` | ||
|
||
## Interactive | ||
|
||
You can then run the container interactively with: | ||
You can then run the container interactively with a command like: | ||
|
||
``` | ||
./rundocker.sh | ||
docker run -it -v ~/PyNIDM:/opt/project pynidm | ||
``` | ||
|
||
This will make a live mount of the files in ~/PyNIDM on your host system | ||
in the directory /opt/PyNIDM in the container. | ||
This will make a live mount of the files in `~/PyNIDM` on your host system in | ||
the directory `/opt/project` in the container. | ||
|
||
## REST Server | ||
|
||
This section assumes you have the PyNIDM source code in ~/PyNIDM. You should | ||
also put any NIDM ttl files you want the REST s erver to process somewhere under the | ||
~/PyNIDM/ttl directory. Once you have done those things, use the command: | ||
This section assumes you have any NIDM ttl files you want the REST server to | ||
process stored under `ttl/` in the current directory. Then, use the command: | ||
|
||
``` | ||
./runrest.sh | ||
docker run -it -p 5000:5000 -v "$PWD/ttl":/opt/project/ttl pynidm-rest | ||
``` | ||
|
||
This should start a HTTP server that is listening on port 5000 of your | ||
This should start an HTTP server that is listening on port 5000 of your | ||
local system. You should be able to connect to the following routes: | ||
|
||
``` | ||
http://localhost:5000/projects | ||
http://localhost:5000/projects/[Project-UUID] | ||
http://localhost:5000/projects/[Project-UUID]/subjects | ||
http://localhost:5000/projects/[Project-UUID]/subjects/[Subject-UUID] | ||
``` | ||
|
||
After the server is started you can continue to modify the files in your | ||
~/PyNIDM/ttl directory and those changes will immediately be reflected in the | ||
REST API results. | ||
After the server is started you can continue to modify the files in your `ttl/` | ||
directory, and those changes will immediately be reflected in the REST API | ||
results. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.