Fixed mt5 container. Runs without errors

This commit is contained in:
Mike
2023-07-16 04:14:41 +02:00
parent 52851c97e8
commit 58c682bcfd
4 changed files with 74 additions and 10 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import time
# Connect to the trading bot container
sio = socketio.Client()
# Replace with the appropriate URL and port of your trading bot container
sio.connect('http://trading_bot:8000')
sio.connect('http://trading_bot:3000')
# Handle events from the trading bot container
+22 -9
View File
@@ -1,21 +1,27 @@
version: "3"
services:
metatrader_service:
build:
context: .
dockerfile: docker/DockerFile.xorg
container_name: metatrader
image: ejtrader/metatrader:5
restart: unless-stopped
environment:
- DISPLAY=$DISPLAY
privileged: true
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
- ./mt5:/mt5
devices:
- /dev/dri:/dev/dri
ports:
- "5900:5900"
- "15555:15555"
- "15556:15556"
- "15557:15557"
- "15558:15558"
volumes:
- ejtraderMT:/data
environment:
- DISPLAY=host.docker.internal:0
- MT5_PASSWORD=your_password
- MT5_SERVER=your_server
networks:
- trading_network
trading_bot:
container_name: trading_bot
@@ -24,8 +30,12 @@ services:
dockerfile: docker/DockerFile
volumes:
- ./app:/app
ports:
- 3000:3000
depends_on:
- metatrader_service
networks:
- trading_network
mt5_bridge:
container_name: mt5_bridge
@@ -37,6 +47,9 @@ services:
depends_on:
- metatrader_service
- trading_bot
networks:
- trading_network
volumes:
ejtraderMT: {}
networks:
trading_network:
driver: bridge
+39
View File
@@ -0,0 +1,39 @@
# Base docker image.
FROM ubuntu:focal
# Install Wine and necessary dependencies
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
gnupg \
software-properties-common \
wget \
winbind \
xauth \
xvfb \
cabextract
# Download and install Wine from WineHQ repository
RUN wget -qO- https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/winehq.gpg && \
add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' && \
apt-get update && \
apt-get install -y --install-recommends winehq-stable winetricks
# Create a non-root user
RUN useradd -m -s /bin/bash trader
# Set the working directory
WORKDIR /home/trader
# Install X server utilities
RUN apt-get install -y x11-xserver-utils x11vnc xvfb
# Configure X server
RUN mkdir /tmp/.X11-unix && \
chown trader:trader /tmp/.X11-unix
# Set up entrypoint script
COPY mt5/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
# Start the X server
Xvfb :0 -screen 0 1024x768x16 &
# Set the X display
export DISPLAY=:0
# Install necessary dependencies using winetricks
winetricks -q corefonts
# Run MetaTrader 5
su - trader -c 'wine "/home/trader/.wine/drive_c/Program Files/MetaTrader 5/terminal64.exe"'