Skip to content

Commit

Permalink
Merge pull request #351 from incf-nidash/cleanup-docker
Browse files Browse the repository at this point in the history
Clean up Docker-related files
  • Loading branch information
yarikoptic authored May 4, 2023
2 parents 31589c6 + ebf5379 commit ab539e5
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 170 deletions.
8 changes: 0 additions & 8 deletions docker-compose.yml

This file was deleted.

40 changes: 6 additions & 34 deletions docker/Dockerfile
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 "docker@example.com"

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 "docker@example.com"
CMD ["/bin/bash"]
13 changes: 0 additions & 13 deletions docker/Dockerfile-datalad

This file was deleted.

7 changes: 3 additions & 4 deletions docker/Dockerfile-rest
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"]
38 changes: 20 additions & 18 deletions docker/README.md
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.
5 changes: 0 additions & 5 deletions docker/build.sh

This file was deleted.

62 changes: 0 additions & 62 deletions docker/rest-blaze.py

This file was deleted.

File renamed without changes.
9 changes: 0 additions & 9 deletions docker/rundatalad.sh

This file was deleted.

8 changes: 0 additions & 8 deletions docker/rundocker.sh

This file was deleted.

9 changes: 0 additions & 9 deletions docker/runrest.sh

This file was deleted.

0 comments on commit ab539e5

Please sign in to comment.