Docker implementation of Haystack on M1

Viewed 55

I'm trying to create a dockerfile for a flask-based python app which relies heavily on haystack. The file reads as follows:

FROM python:3.9

WORKDIR /app # setting the docker working directory

COPY . / # copying all python files, requirements.txt etc from the folder

RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt # this includes farm-haystack


EXPOSE 5000 # this is a flask-based app, so I want to run a local instance on port 5000

ENTRYPOINT [ "python" ]

CMD [ "app.py" ] # the main file of the app, which tries but fails to load in the haystack library

When running the docker container, it throws module not found errors for haystack modules (but not for any of the others) on import attempts right at the beginning of the file.

I'm trying to run this on an Apple M1 laptop, want it to be platform agnostic though, so that the docker container can easily be shared with others working in different OS environments.

Any help or advice would be greatly appreciated!

1 Answers

This turned out to be a simple dependency issue. To solve, simply change requirements to:

elasticsearch==7.10.1

farm-haystack==1.6.0

Related