-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
63 lines (53 loc) · 2.65 KB
/
Dockerfile
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
FROM alexiri/scipy:3.8 as build_env
ENV BEANCOUNT_VERSION "2.3.3"
ENV FAVA_VERSION "v1.18"
ENV BUILDDEPS "libxml2-dev libxslt1-dev gcc musl-dev git nodejs npm make g++ liblapack-dev gfortran"
# Short python version.
ENV PV "3.8"
WORKDIR /root
RUN apt update \
&& apt install -y ${BUILDDEPS} \
&& pip install --upgrade pip \
&& npm install -g npm@latest \
&& python3 -mpip install importlib_metadata
RUN echo "Install Beancount & Fava" \
&& git clone --branch ${BEANCOUNT_VERSION} --depth 1 https://github.com/beancount/beancount.git \
&& (cd beancount && git log -l1) \
&& git clone --branch ${FAVA_VERSION} --depth 1 https://github.com/beancount/fava.git \
&& (cd fava && git log -1) \
&& echo "Deleting symlink files as they will cause docker build error" \
&& find ./ -type l -delete -print \
&& python3 -mpip install ./beancount \
&& make -C fava \
&& make -C fava mostlyclean \
&& python3 -mpip install ./fava
RUN echo "Install Smart Importer" \
&& git clone https://github.com/beancount/smart_importer.git \
&& (cd smart_importer && git log -1) \
&& python3 -mpip install ./smart_importer \
&& python3 -mpip install beancount_portfolio_allocation \
&& python3 -mpip install pip install https://github.com/xuhcc/beancount-cryptoassets/archive/master.zip \
&& python3 -mpip install pip install https://github.com/xuhcc/beancount-exchangerates/archive/master.zip \
&& python3 -mpip install pip install https://github.com/tarioch/beancounttools/archive/master.zip \
&& python3 -mpip install fava-investor \
#&& echo "strip .so files:" \
#&& find /usr/local/lib/python${PV}/site-packages -name *.so -print0|xargs -0 strip -v \
&& echo "remove __pycache__ directories" \
&& find /usr/local/lib/python${PV} -name __pycache__ -exec rm -rf -v {} + \
&& find /usr/local/lib/python${PV} -name '*.dist-info' -exec rm -rf -v {} +
FROM tiangolo/uwsgi-nginx-flask:python3.8
ENV BEANCOUNT_INPUT_FILE "/data/example.beancount"
ENV PV "3.8"
RUN rm -f /app/*
VOLUME /data
RUN apt update \
&& apt install -y liblapack3 ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build_env /usr/local/lib/python${PV}/site-packages /usr/local/lib/python${PV}/site-packages
COPY --from=build_env /usr/local/bin/fava /usr/local/bin
COPY --from=build_env /usr/local/bin/bean* /usr/local/bin/
ADD amortize_over.py /usr/local/lib/python${PV}/site-packages
RUN cp -r /usr/local/lib/python${PV}/site-packages/fava/static /app
COPY main.py /app
COPY uwsgi.ini /app
COPY example.beancount /data