-
-
Notifications
You must be signed in to change notification settings - Fork 83
/
Dockerfile
103 lines (83 loc) 路 2.5 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
95
96
97
98
99
100
101
102
103
# Set the base Ubuntu image.
FROM ubuntu:xenial AS ubuntu-base
ENV DEBIAN_FRONTEND noninteractive
# Setup the default user.
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1001 ubuntu
USER ubuntu
WORKDIR /home/ubuntu
# Provision.
FROM ubuntu-base AS ubuntu-provisioned
USER root
# Build-time variables.
ARG HTTPS_PROXY
ARG HTTP_PROXY
ARG PROVISION_AHK=0
ARG PROVISION_CHARLES=0
ARG PROVISION_MONO=0
ARG PROVISION_SSH=0
ARG PROVISION_SUDO=1
ARG PROVISION_VNC=1
# Provision container image.
COPY scripts /opt/scripts
ENV PATH $PATH:/opt/scripts:/opt/scripts/py
ENV PROVISION_HASH KwFCBBn659lGNLNiIGd5131XnknI
RUN provision.sh
# Clean up.
RUN find /var/lib/apt/lists -type f -delete && \
find /tmp -mindepth 1 '(' -type d -o -type f ')' -delete
# Uses ubuntu as default user.
USER ubuntu
# Setup EA Tester base image.
FROM ubuntu-provisioned AS ea-tester-base
# Add files.
COPY conf /opt/conf
COPY tests /opt/tests
# Setup results directory.
ARG BT_DEST=/opt/results
ENV BT_DEST $BT_DEST
RUN mkdir -v -m a=rwx $BT_DEST && \
chown ubuntu:root $BT_DEST
VOLUME $BT_DEST
# Install MT4 platform.
FROM ea-tester-base AS ea-tester-with-mt4
# Install platform.
ARG MT_VER=4.0.0.1382
RUN eval.sh install_mt $MT_VER && \
run_backtest.sh -s PrintPaths -v
# Clean up.
RUN eval.sh clean_bt && \
eval.sh clean_ea && \
eval.sh clean_files && \
find /tmp -mindepth 1 -print -delete
# Install MT5 platform.
FROM ea-tester-base AS ea-tester-with-mt5
# Install platform.
ARG MT_VER=5.0.0.3802
ENV MT_VER $MT_VER
RUN eval.sh install_mt $MT_VER
#RUN run_backtest.sh -s PrintPaths -v
# Clean up.
#RUN eval.sh clean_bt
#RUN eval.sh clean_ea
#RUN eval.sh clean_files
# Final EA Tester image.
FROM ea-tester-with-mt4 as ea-tester
# Build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="EA-Tester" \
org.label-schema.description="Headless Forex backtesting for MetaTrader platform" \
org.label-schema.url="https://github.com/EA31337/EA-Tester" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/EA31337/EA-Tester" \
org.label-schema.vendor="FX31337" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"
# Modify shell startup scripts.
RUN echo source /opt/scripts/.funcs.cmds.inc.sh >> ~/.bashrc
# Expose SSH and VNC when installed.
EXPOSE 22 5900
# Configure a container as an executable.
ENTRYPOINT ["eval.sh"]