polakowo/vectorbt

Dockerfile changes to run /apps/candlestick-patterns app

dcorb opened this issue · 0 comments

It didn't work for me, got some help from chatGPT:

To make the original Dockerfile work on macOS, the minimal changes needed are to update the config.guess and config.sub scripts before running the configure script. Here is the modified Dockerfile:

Dockerfile

FROM python:3.8-slim

RUN apt-get -y update && apt-get -y install gcc curl make dos2unix

RUN pip install --upgrade pip
# Required by TA-Lib and numba
RUN pip install numpy>=1.19.4

RUN curl -O https://netcologne.dl.sourceforge.net/project/ta-lib/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz \
    && tar -xzf ta-lib-0.4.0-src.tar.gz \
    && cd ta-lib/ \
    && curl -O https://git.savannah.gnu.org/cgit/config.git/plain/config.guess \
    && curl -O https://git.savannah.gnu.org/cgit/config.git/plain/config.sub \
    && chmod +x config.guess config.sub \
    && dos2unix config.guess config.sub \
    && ./configure --prefix=/usr \
    && make \
    && make install \
    && cd ..

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY assets ./assets
COPY app.py .

CMD ["python", "app.py"]

## Explanation of Changes

Install dos2unix: Added dos2unix to the list of packages installed by apt-get.
Update config.guess and config.sub:
Added steps to download the latest config.guess and config.sub scripts from the GNU repository.
Added steps to set the executable permissions for these scripts.
Added a step to convert line endings using dos2unix.
These changes ensure that the config.guess and config.sub scripts are up to date and compatible with the build environment, resolving issues related to cross-compilation and system recognition.