Skip to content
Moritz Wolf edited this page Feb 2, 2022 · 2 revisions

Here is an example docker file to run HUMAN in a container:

FROM continuumio/miniconda3

WORKDIR /src

# Create the environment:
ADD environment.yml /tmp/environment.yml
RUN conda env create -f /tmp/environment.yml

# Make RUN commands use the new environment:
# SHELL ["conda", "run", "-n", "human", "/bin/bash", "-c"]

# Make sure the environment is activated:
# RUN echo "Make sure flask is installed:"
# RUN python -c "import flask"

# Copy files
COPY app app
COPY data data
COPY instance instance
COPY uploaded_files uploaded_files
# COPY logo.png .
COPY start.py .
COPY config.py .
COPY protocol.yml .

# The code to run when container is started:
# -

# Start with Gunicorn
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "human", "gunicorn", "-b=0.0.0.0:8000", "-w=3", "--worker-tmp-dir=/dev/shm", "--log-level=debug", "start"]
# For normal flask run:
# ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "human", "flask", "run", "--host=0.0.0.0"]

However you first have to set up the project on your own machine to get a working system and when you are sure it is working build the image.

Pipeline

  1. Set up an annotation tool on a local machine as described in Setup. Make sure everything works as intended
  2. Build an image named <name> with docker build --progress=plain -t <imagename> .
  3. Run a container for that image with docker run -p <dockerport>:<local port> -it <imagename>
    <localport> is the port on your machine where the program is running and <dockerport>(default 5000) the one where gunicorn or flask is hosting the server in the container.
    If the docker is running on a server make sure to match localport with an open one to the outside so you can actually access it.

Shortcut for extracting the database from the container:

docker cp <containername>:/src/instance/database.sqlite <a safe place>
Clone this wiki locally