This repository has been archived by the owner on Dec 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile-alpine.template
68 lines (56 loc) · 2.43 KB
/
Dockerfile-alpine.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
FROM westonsteimel/quantlib:%%QL_BUILDER_TAG%% as ql
FROM python:%%PYTHON_TAG%% as ql-python
COPY --from=ql /usr/local/lib/libQuantLib.la /usr/local/lib/
COPY --from=ql /usr/local/lib/libQuantLib.so.0.0.0 /usr/local/lib/
COPY --from=ql /usr/local/bin/quantlib-config /usr/local/bin/
COPY --from=ql /usr/local/include/ /usr/local/include/
COPY --from=ql /usr/include /usr/include
RUN cd /usr/local/lib && ln -s libQuantLib.so.0.0.0 libQuantLib.so.0
RUN cd /usr/local/lib && ln -s libQuantLib.so.0.0.0 libQuantLib.so
RUN ldconfig /usr/local/lib
ARG CONCURRENT_PROCESSES=1
ARG QUANTLIB_SWIG_VERSION=%%QUANTLIB_SWIG_VERSION%%
ARG QUANTLIB_SWIG_DIR=quantlib_swig
ARG QUANTLIB_SWIG_CHECKSUM=%%QUANTLIB_SWIG_CHECKSUM%%
ENV QUANTLIB_SWIG_VERSION=${QUANTLIB_SWIG_VERSION}
ENV QUANTLIB_SWIG_CHECKSUM=${QUANTLIB_SWIG_CHECKSUM}
RUN mkdir -p ${QUANTLIB_SWIG_DIR} \
&& apk --no-cache upgrade \
&& apk --no-cache add --virtual .build-dependencies \
linux-headers \
build-base \
automake \
autoconf \
libtool \
curl \
swig \
tar \
ca-certificates \
&& cd ${QUANTLIB_SWIG_DIR} \
&& curl -fSL --retry 3 https://github.com/lballabio/QuantLib-SWIG/releases/download/QuantLib-SWIG-v${QUANTLIB_SWIG_VERSION}/QuantLib-SWIG-${QUANTLIB_SWIG_VERSION}.tar.gz -o quantlib-swig.tar.gz \
&& echo "${QUANTLIB_SWIG_CHECKSUM} quantlib-swig.tar.gz" | sha256sum -c \
&& tar -xzf quantlib-swig.tar.gz --strip 1 \
&& cd Python \
&& CXXFLAGS='-g0 -O3' python setup.py bdist_wheel \
&& apk del .build-dependencies \
&& rm -rf /var/cache/*
FROM python:%%PYTHON_TAG%%
LABEL description="An Alpine Linux environment with the QuantLib Python module"
ARG PYTHON_LIB_PATH=%%PYTHON_LIB_PATH%%
ARG QUANTLIB_SWIG_VERSION=%%QUANTLIB_SWIG_VERSION%%
ENV QUANTLIB_SWIG_VERSION ${QUANTLIB_SWIG_VERSION}
COPY --from=ql-python /usr/local/lib/libQuantLib.la /usr/local/lib/
COPY --from=ql-python /usr/local/lib/libQuantLib.so.0.0.0 /usr/local/lib/
COPY --from=ql-python /quantlib_swig/Python/dist/QuantLib_Python*.whl /tmp
RUN addgroup -g 1000 quantlib \
&& adduser -u 1000 -G quantlib -s /bin/sh -D quantlib \
&& apk --no-cache upgrade \
&& apk --no-cache add libstdc++ \
&& cd /usr/local/lib \
&& ln -s libQuantLib.so.0.0.0 libQuantLib.so.0 \
&& ln -s libQuantLib.so.0.0.0 libQuantLib.so \
&& pip install /tmp/QuantLib_Python*.whl \
&& ldconfig /usr/local/lib \
&& chmod -R +x /usr/local/lib/
USER quantlib
CMD ["python"]