From 8573a5b6d9fa3d6f895a2a437776173faf7ce62f Mon Sep 17 00:00:00 2001 From: Florian Borchert Date: Wed, 4 Dec 2024 17:29:28 +0100 Subject: [PATCH] Docker --- Dockerfile | 14 ++++++-------- README.md | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 60cfa22..e7fa40f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,10 @@ FROM continuumio/miniconda3:latest # Set the working directory WORKDIR / +# Copy the application code and requirements file into the container +COPY requirements.txt . +COPY *.py . + # Update the package list and install any dependencies RUN apt-get update && apt-get install -y \ curl git \ @@ -11,16 +15,10 @@ RUN apt-get update && apt-get install -y \ # Create a new conda environment with Python 3.10 RUN conda create --name xmen python=3.10 -y - -# Activate the environment and ensure it persists SHELL ["conda", "run", "-n", "xmen", "/bin/bash", "-c"] -# Copy the application code and requirements file into the container -COPY requirements.txt . -COPY *.py . - # Install binary dependencies from conda -RUN conda install -c conda-forge nmslib cymem murmurhash -y +RUN conda install -n xmen -c conda-forge nmslib cymem murmurhash -y # Install pip dependencies RUN pip install --no-cache-dir -r requirements.txt @@ -28,4 +26,4 @@ RUN pip install --no-cache-dir -r requirements.txt EXPOSE 5000 # Define the command to run the server with parameters -CMD ["/opt/conda/envs/xmen/python", "run_snomed_german_recommender.py", "--no-gpu", "--port", "5000", "index"] \ No newline at end of file +CMD ["conda", "run", "-n", "xmen", "python3", "run_snomed_german_recommender.py", "--no-gpu", "--port", "5000", "index"] diff --git a/README.md b/README.md index f597877..5dc733b 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Simple integration of pre-configured [xMEN](https://github.com/hpi-dhc/xmen) pip ### With Docker -- `docker build -t xmen-inception` -- `` +- `docker build -t inception-xmen-snomed .` +- `docker run -m=12g -p 5002:5000 -v "$(pwd)"/xmen_index/index:/index/ inception-xmen-snomed` ### Without Docker