-
Notifications
You must be signed in to change notification settings - Fork 33
/
Dockerfile
83 lines (67 loc) · 2.25 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
ARG IB_GATEWAY_VERSION=1012.2i
ARG IBC_VERSION=3.12.0
#
# Setup Stage: install apps
#
# This is a dedicated stage so that donwload archives don't end up on
# production image and consume unnecessary space.
#
FROM ubuntu:20.04 as setup
ARG IB_GATEWAY_VERSION
ARG IBC_VERSION
# Prepare system
RUN apt-get update -y
RUN apt-get install --no-install-recommends --yes \
curl \
ca-certificates \
unzip
WORKDIR /tmp/setup
COPY ./checksums ./checksums
# Install IB Gateway
# Use this instead of "RUN curl .." to install a local file:
#COPY ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh .
RUN curl -sSL https://github.com/waytrade/ib-gateway-docker/releases/download/v${IB_GATEWAY_VERSION}/ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh --output ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh
RUN sha256sum --check ./checksums/ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh.sha256
RUN chmod a+x ./ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh
RUN ./ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh -q -dir /root/Jts/ibgateway/${IB_GATEWAY_VERSION}
COPY ./config/ibgateway/jts.ini /root/Jts/jts.ini
COPY ./config/ibgateway/ibgateway.vmoptions /root/Jts/ibgateway/${IB_GATEWAY_VERSION}/
# Install IBC
RUN curl -sSL https://github.com/IbcAlpha/IBC/releases/download/${IBC_VERSION}/IBCLinux-${IBC_VERSION}.zip --output IBCLinux-${IBC_VERSION}.zip
RUN mkdir /root/ibc
RUN unzip ./IBCLinux-${IBC_VERSION}.zip -d /root/ibc
RUN chmod -R u+x /root/ibc/*.sh
RUN chmod -R u+x /root/ibc/scripts/*.sh
COPY ./config/ibc/config.ini /root/ibc/config.ini
# Copy scripts
COPY ./scripts /root/scripts
#
# Build Stage: build production image
#
FROM ubuntu:20.04
ARG IB_GATEWAY_VERSION
ARG IBC_VERSION
WORKDIR /root
# Prepare system
RUN apt-get update -y
RUN apt-get install --no-install-recommends --yes \
xvfb \
libxslt-dev \
libxrender1 \
libxtst6 \
libxi6 \
libgtk2.0-bin \
socat \
x11vnc
# Copy files
COPY --from=setup /root/ .
RUN chmod a+x /root/scripts/*.sh
COPY --from=setup /usr/local/i4j_jres/ /usr/local/i4j_jres
# IBC env vars
ENV TWS_MAJOR_VRSN ${IB_GATEWAY_VERSION}
ENV TWS_PATH /root/Jts
ENV IBC_PATH /root/ibc
ENV IBC_INI /root/ibc/config.ini
ENV TWOFA_TIMEOUT_ACTION exit
# Start run script
CMD ["/root/scripts/run.sh"]