Skip to content

Instantly share code, notes, and snippets.

@falkolab
Last active October 23, 2022 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save falkolab/f6edc28d2e95d82d42956969a02ea351 to your computer and use it in GitHub Desktop.
Save falkolab/f6edc28d2e95d82d42956969a02ea351 to your computer and use it in GitHub Desktop.
Docker. Install TA-lib alpine wheel multistage build
FROM python:3-alpine as talib_build
# TA-Lib
RUN apk add --virtual .build-deps musl-dev build-base && \
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && tar -xvzf ta-lib-0.4.0-src.tar.gz && \
cd ta-lib/ && ./configure --prefix=/talib_dist && make && make install && \
python3 -m pip wheel --wheel-dir=/wheels TA-Lib==0.4.24 && \
apk del .build-deps && cd .. && rm -rf ./ta-lib && rm -rf ./ta-lib-0.4.0-src.tar.gz
FROM python:3-alpine
# TA-lib install
COPY --from=talib_build /wheels /wheels
COPY --from=talib_build /talib_dist /talib_dist
RUN pip install --no-index --find-links=/wheels TA-Lib==0.4.24
# Preapare tools
RUN python3 -m ensurepip && pip3 install --no-cache --upgrade pip setuptools
# App install
COPY requirements.txt .
# Add necessary alpine packages for to proper install (BUILD packages deps not for the app execute) python packages
RUN apk add --virtual .build-deps git build-base gcc && \
python3 -m pip install -r requirements.txt && \
apk del .build-deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment