forked from zalf-rpm/monica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
94 lines (74 loc) · 3 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#Download base image debian 9.5
FROM debian:10.3 AS build-env
# Update Ubuntu Software repository
RUN apt-get update
# install monica prerequisites
RUN apt-get install -y apt-utils curl unzip tar cmake
RUN apt-get install -y git python-pip python-dev build-essential
ARG VERSION_MAYOR="false"
ARG VERSION_MINOR="false"
ARG VERSION_PATCH="false"
ENV WORK_DIR /resource
RUN mkdir ${WORK_DIR}
WORKDIR ${WORK_DIR}
RUN git clone https://github.com/zalf-rpm/build-pipeline.git
RUN git clone https://github.com/zalf-rpm/monica.git
RUN git clone https://github.com/zalf-rpm/util.git
RUN git clone https://github.com/zalf-rpm/capnproto_schemas.git
WORKDIR ${WORK_DIR}/build-pipeline/buildscripts
RUN sh linux-prepare-vcpkg.sh
WORKDIR ${WORK_DIR}
RUN python build-pipeline/buildscripts/incrementversion.py "monica/src/resource/version.h" ${VERSION_MAYOR} ${VERSION_MINOR} ${VERSION_PATCH}
WORKDIR ${WORK_DIR}/monica
RUN sh update_linux.sh
WORKDIR ${WORK_DIR}/monica/_cmake_linux
RUN make
FROM debian:10.3
ENV DEBIAN_FRONTED noninteractive
# Update Ubuntu Software repository
RUN apt-get update
# install monica prerequisites
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y supervisor && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /run/monica/sqlite-db
ENV monica_dir /run/monica
ENV supervisor_conf /etc/supervisor/supervisord.conf
ENV monica_instances 3
ENV MONICA_WORK /monica_data
ENV MONICA_HOME ${monica_dir}
ENV monica_autostart_proxies=true
ENV monica_autostart_worker=true
ENV monica_auto_restart_proxies=true
ENV monica_auto_restart_worker=true
ENV monica_proxy_in_host=localhost
ENV monica_proxy_out_host=localhost
ENV monica_intern_in_port=6677
ENV monica_intern_out_port=7788
ENV monica_consumer_port=7777
ENV monica_producer_port=6666
ENV EXECUTABLE_SOURCE /resource/monica/_cmake_linux
COPY docker/supervisord.conf ${supervisor_conf}
RUN mkdir -p $MONICA_WORK
RUN chmod -R 777 ${MONICA_WORK}
RUN chmod -R +rx ${monica_dir}
RUN touch /var/log/supervisord.log
RUN chmod 777 /var/log/supervisord.log
# copy executables
COPY --from=build-env ${EXECUTABLE_SOURCE}/monica ${monica_dir}
COPY --from=build-env ${EXECUTABLE_SOURCE}/monica-run ${monica_dir}
COPY --from=build-env ${EXECUTABLE_SOURCE}/monica-zmq-control-send ${monica_dir}
COPY --from=build-env ${EXECUTABLE_SOURCE}/monica-zmq-run ${monica_dir}
COPY --from=build-env ${EXECUTABLE_SOURCE}/monica-zmq-control ${monica_dir}
COPY --from=build-env ${EXECUTABLE_SOURCE}/monica-zmq-proxy ${monica_dir}
COPY --from=build-env ${EXECUTABLE_SOURCE}/monica-zmq-server ${monica_dir}
# copy sqlite db
COPY sqlite-db/ka5-soil-data.sqlite ${monica_dir}/sqlite-db/
COPY sqlite-db/carbiocial.sqlite ${monica_dir}/sqlite-db/
COPY sqlite-db/monica.sqlite ${monica_dir}/sqlite-db/
COPY db-connections-install.ini ${monica_dir}/db-connections.ini
COPY docker/start_monica_supervisor.sh /start.sh
RUN useradd -ms /bin/bash myuser
USER myuser
CMD ["sh", "/start.sh"]
ENV DEBIAN_FRONTED teletype
EXPOSE ${monica_producer_port} ${monica_consumer_port} ${monica_intern_in_port} ${monica_intern_out_port}