Я выполняю шаги https://pythonspeed.com/articles/activate-conda-dockerfile/#working Первая часть, в которой я создаю среду, работает нормально. Файл Dockerfile показан ниже:
FROM continuumio/miniconda3
WORKDIR /app
# Create the environment:
COPY environment.yml .
RUN conda env create -f environment.yml
# Make RUN commands use the new environment:
SHELL ["conda", "run", "-n", "myenv", "/bin/bash", "-c"]
# Make sure the environment is activated:
RUN echo "Make sure flask is installed:"
RUN python -c "import spacy"
# The code to run when container is started:
COPY run.py .
ENTRYPOINT ["conda", "run", "-n", "myenv", "python", "run.py"]
Я использую этот базовый образ и загружаю модель в новом образе:
FROM condatest:latest
WORKDIR /app
# Make RUN commands use the new environment:
SHELL ["conda", "run", "-n", "myenv", "/bin/bash", "-c"]
SHELL ["conda", "run", "-n", "myenv", "python", "-m", "spacy", "download", "en_core_web_sm"]
SHELL ["conda", "run", "-n", "myenv", "python", "-m", "spacy", "validate"]
COPY run.py .
ENTRYPOINT ["conda", "run", "-n", "myenv", "python", "run.py"]
The validate step is also passing. But the code receives the error: `OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.` Is including Conda in the docker image over complicating things?