-
Notifications
You must be signed in to change notification settings - Fork 45
/
Dockerfile.template
92 lines (72 loc) · 2.31 KB
/
Dockerfile.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
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
FROM debian:bookworm-slim as downloader
# IBC Version : https://github.com/IbcAlpha/IBC/releases
ARG IBC_VER="###IBC_VER###"
ARG IBC_ASSET_URL="###IBC_ASSET_URL###"
# set environment variables
ENV IBC_INI=/root/ibc/config.ini \
IBC_PATH=/opt/ibc
# install dependencies
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y wget \
unzip
# make dirs
RUN mkdir -p /tmp
# download IB TWS
RUN wget -q -O /tmp/ibgw.sh https://download2.interactivebrokers.com/installers/ibgateway/stable-standalone/ibgateway-stable-standalone-linux-x64.sh
RUN chmod +x /tmp/ibgw.sh
# download IBC
RUN wget -q -O /tmp/IBC.zip ${IBC_ASSET_URL}
RUN unzip /tmp/IBC.zip -d ${IBC_PATH}
RUN chmod +x ${IBC_PATH}/*.sh ${IBC_PATH}/*/*.sh
# copy IBC/Jts configs
COPY ibc/config.ini ${IBC_INI}
FROM debian:bookworm-slim
ARG IB_GATEWAY_MAJOR="###IB_GATEWAY_MAJOR###"
ARG IB_GATEWAY_MINOR="###IB_GATEWAY_MINOR###"
# install dependencies
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
xvfb \
libxtst6 \
libxrender1 \
net-tools \
x11-utils \
socat \
procps \
xterm
RUN apt install -y openjdk-17-jre
# set environment variables
ENV TWS_INSTALL_LOG=/root/Jts/tws_install.log \
IBC_INI=/root/ibc/config.ini \
IBC_PATH=/opt/ibc \
TWS_PATH=/root/Jts \
TWOFA_TIMEOUT_ACTION=restart \
IB_GATEWAY_MAJOR=${IB_GATEWAY_MAJOR} \
IB_GATEWAY_MINOR=${IB_GATEWAY_MINOR} \
IB_GATEWAY_VERSION=${IB_GATEWAY_MAJOR}${IB_GATEWAY_MINOR}
# make dirs
RUN mkdir -p /tmp && mkdir -p ${IBC_PATH} && mkdir -p ${TWS_PATH}
# download IB TWS
COPY --from=downloader /tmp/ibgw.sh /tmp/ibgw.sh
RUN /tmp/ibgw.sh -q -dir /root/Jts/ibgateway/${IB_GATEWAY_VERSION}
# remove downloaded files
RUN rm /tmp/ibgw.sh
COPY --from=downloader /opt/ibc /opt/ibc
COPY --from=downloader /root/ibc /root/ibc
# install healthcheck tool
ADD healthcheck/healthcheck/build/distributions/healthcheck.tar /
ENV PATH="${PATH}:/healthcheck/bin"
ADD healthcheck/healthcheck-rest/build/distributions/healthcheck-rest-boot.tar /
ENV PATH="${PATH}:/healthcheck-rest-boot/bin"
# copy cmd script
WORKDIR /root
COPY start.sh /root/start.sh
RUN chmod +x /root/start.sh
# set display environment variable (must be set after TWS installation)
ENV DISPLAY=:0
ENV IBGW_PORT 4002
ENV JAVA_HEAP_SIZE 768
EXPOSE $IBGW_PORT
ENTRYPOINT [ "sh", "/root/start.sh" ]