From 8761ed8e433f80ad2fd67eab6bc2279466fb72f3 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 27 Jan 2024 23:51:04 +0000 Subject: [PATCH] Installs platform via Ansible --- Dockerfile | 35 +++++++++++++++-------------------- ansible/mt-install.yml | 4 ++++ 2 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 ansible/mt-install.yml diff --git a/Dockerfile b/Dockerfile index f79511b2..592a4002 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Set the base Ubuntu image. -FROM ubuntu:bionic AS ubuntu-base +FROM ubuntu:latest AS ubuntu-base ENV DEBIAN_FRONTEND noninteractive # Setup the default user. @@ -11,25 +11,19 @@ WORKDIR /home/ubuntu 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=1 -ARG PROVISION_SSH=0 -ARG PROVISION_SUDO=1 -ARG PROVISION_VNC=1 - # Provision container image. +COPY ansible /opt/ansible COPY scripts /opt/scripts ENV PATH $PATH:/opt/scripts:/opt/scripts/py -ENV PROVISION_HASH KwFCBBn659lGNLNiIGd5131XnknI -RUN provision.sh +#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 +RUN apt update \ + && apt -qqq install ansible git \ + && ansible-galaxy install git+https://github.com/EA31337/ansible-role-mt-runner.git,dev \ + && ansible-playbook -i "localhost," -c local /opt/ansible/mt-install.yml -v \ + && rm -fr ~/.ansible /tmp/* \ + && find /var/lib/apt/lists -type f -delete # Uses ubuntu as default user. USER ubuntu @@ -52,9 +46,9 @@ VOLUME $BT_DEST FROM ea-tester-base AS ea-tester-with-mt4 # Install platform. -ARG MT_VER=4 -RUN eval.sh install_mt $MT_VER && \ - run_backtest.sh -s PrintPaths -v +RUN ansible-playbook -i "localhost," -c local -e metatrader_version=4 /opt/ansible/mt-install.yml -v \ +#ARG MT_VER=4 +#RUN eval.sh install_mt $MT_VER && run_backtest.sh -s PrintPaths -v # Clean up. RUN eval.sh clean_bt && \ @@ -68,7 +62,8 @@ FROM ea-tester-base AS ea-tester-with-mt5 # Install platform. ARG MT_VER=5 ENV MT_VER $MT_VER -RUN eval.sh install_mt $MT_VER +RUN ansible-playbook -i "localhost," -c local -e metatrader_version=5 /opt/ansible/mt-install.yml -v \ +#RUN eval.sh install_mt $MT_VER #RUN run_backtest.sh -s PrintPaths -v # Clean up. diff --git a/ansible/mt-install.yml b/ansible/mt-install.yml new file mode 100644 index 00000000..95424fef --- /dev/null +++ b/ansible/mt-install.yml @@ -0,0 +1,4 @@ +--- +- hosts: localhost + roles: + - ea31337.metatrader