33# ##############################################################################
44# hadolint global ignore=DL3003,DL3008,SC2028
55ARG IMG_PYTHON_VERSION
6- FROM python:"${ IMG_PYTHON_VERSION}" AS builder
6+ FROM python:$ IMG_PYTHON_VERSION AS builder
77
88ENV APT_PROXY_FILE=/etc/apt/apt.conf.d/01proxy
9+ ARG GH_URL_BASE=https://github.com/quantbelt/jupyter-quant/releases/download/ta-lib-0.4.0-linux
10+ ARG TALIB_FILE=ta-lib-0.4.0-linux_
11+ ARG TALIB_URL="${GH_URL_BASE}/${TALIB_FILE}"
912
10- COPY requirements.txt /.
13+ COPY README.md LICENSE.txt pyproject.toml /
14+ COPY jupyter_quant/__init__.py /jupyter_quant/
1115
1216SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
1317RUN if [ -n "$APT_PROXY" ]; then \
@@ -22,30 +26,30 @@ RUN if [ -n "$APT_PROXY" ]; then \
2226 apt-get clean && rm -rf /var/lib/apt/lists/* && \
2327 # # TA-Lib
2428 cd /tmp && \
25- curl -LO https://github.com/quantbelt/jupyter-quant/releases/download/ta-lib-0.4.0-linux/ta-lib-0.4.0-linux_ "$ (uname -m)" .tgz && \
26- curl -LO https://github.com/quantbelt/jupyter-quant/releases/download/ta-lib-0.4.0-linux/ta-lib-0.4.0-linux_ "$ (uname -m)" .tgz.sha256 && \
27- sha256sum -c ta-lib-0.4.0-linux_ "$ (uname -m)" .tgz.sha256 && \
28- cd / && tar xzf /tmp/ta-lib-0.4.0-linux_ "$ (uname -m)" .tgz && \
29+ curl -LO "${TALIB_URL}$ (uname -m).tgz" && \
30+ curl -LO "${TALIB_URL}$ (uname -m).tgz.sha256" && \
31+ sha256sum -c "${TALIB_FILE}$ (uname -m).tgz.sha256" && \
32+ cd / && tar xzf " /tmp/${TALIB_FILE}$ (uname -m).tgz" && \
2933 export PREFIX=/usr/local/ta-lib && \
3034 export TA_LIBRARY_PATH="$PREFIX/lib" && \
3135 export TA_INCLUDE_PATH="$PREFIX/include" && \
3236 # end TA-Lib
33- pip wheel --no-cache-dir --wheel-dir /wheels -r /requirements.txt
37+ pip wheel --no-cache-dir --wheel-dir /wheels .
3438
3539# ##############################################################################
3640# Final stage
3741# ##############################################################################
3842ARG IMG_PYTHON_VERSION
39- FROM python:" ${IMG_PYTHON_VERSION}" -slim
43+ FROM python:${IMG_PYTHON_VERSION}-slim
4044
4145ENV APT_PROXY_FILE=/etc/apt/apt.conf.d/01proxy
4246
4347ENV USER="${USER:-gordon}"
4448ARG USER_ID="${USER_ID:-1000}"
4549ARG USER_GID="${USER_GID:-1000}"
46- ENV PYTHONDONTWRITEBYTECODE 1
47- ENV PYTHONUNBUFFERED 1
48- ENV PIP_USER true
50+ ENV PYTHONDONTWRITEBYTECODE= 1
51+ ENV PYTHONUNBUFFERED= 1
52+ ENV PIP_USER= true
4953ENV PATH="$PATH:/home/$USER/.local/bin"
5054
5155# base data directory
@@ -100,11 +104,10 @@ USER $USER_ID:$USER_GID
100104
101105SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
102106RUN --mount=type=bind,from=builder,source=/wheels,target=/wheels \
103- pip install --user --no-cache-dir /wheels/* && \
107+ pip install --user --no-deps --compile --no- cache-dir /wheels/* && \
104108 # Import matplotlib the first time to build the font cache.
105109 MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \
106- mkdir "${JUPYTER_SERVER_ROOT}" && \
107- python -c "import compileall; compileall.compile_dir('${BASE_DATA}/lib/python$(echo " $PYTHON_VERSION" | cut -d '.' -f1,2)/site-packages', force=True)"
110+ mkdir "${JUPYTER_SERVER_ROOT}"
108111
109112COPY entrypoint.sh /
110113WORKDIR ${JUPYTER_SERVER_ROOT}
0 commit comments