Fixed mt5 container. Runs without errors
This commit is contained in:
@@ -4,7 +4,7 @@ import time
|
|||||||
# Connect to the trading bot container
|
# Connect to the trading bot container
|
||||||
sio = socketio.Client()
|
sio = socketio.Client()
|
||||||
# Replace with the appropriate URL and port of your trading bot container
|
# 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
|
# Handle events from the trading bot container
|
||||||
|
|
||||||
|
|||||||
+22
-9
@@ -1,21 +1,27 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
metatrader_service:
|
metatrader_service:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/DockerFile.xorg
|
||||||
container_name: metatrader
|
container_name: metatrader
|
||||||
image: ejtrader/metatrader:5
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- DISPLAY=$DISPLAY
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- /tmp/.X11-unix:/tmp/.X11-unix
|
||||||
|
- ./mt5:/mt5
|
||||||
|
devices:
|
||||||
|
- /dev/dri:/dev/dri
|
||||||
ports:
|
ports:
|
||||||
- "5900:5900"
|
- "5900:5900"
|
||||||
- "15555:15555"
|
- "15555:15555"
|
||||||
- "15556:15556"
|
- "15556:15556"
|
||||||
- "15557:15557"
|
- "15557:15557"
|
||||||
- "15558:15558"
|
- "15558:15558"
|
||||||
volumes:
|
networks:
|
||||||
- ejtraderMT:/data
|
- trading_network
|
||||||
environment:
|
|
||||||
- DISPLAY=host.docker.internal:0
|
|
||||||
- MT5_PASSWORD=your_password
|
|
||||||
- MT5_SERVER=your_server
|
|
||||||
|
|
||||||
trading_bot:
|
trading_bot:
|
||||||
container_name: trading_bot
|
container_name: trading_bot
|
||||||
@@ -24,8 +30,12 @@ services:
|
|||||||
dockerfile: docker/DockerFile
|
dockerfile: docker/DockerFile
|
||||||
volumes:
|
volumes:
|
||||||
- ./app:/app
|
- ./app:/app
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
depends_on:
|
depends_on:
|
||||||
- metatrader_service
|
- metatrader_service
|
||||||
|
networks:
|
||||||
|
- trading_network
|
||||||
|
|
||||||
mt5_bridge:
|
mt5_bridge:
|
||||||
container_name: mt5_bridge
|
container_name: mt5_bridge
|
||||||
@@ -37,6 +47,9 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- metatrader_service
|
- metatrader_service
|
||||||
- trading_bot
|
- trading_bot
|
||||||
|
networks:
|
||||||
|
- trading_network
|
||||||
|
|
||||||
volumes:
|
networks:
|
||||||
ejtraderMT: {}
|
trading_network:
|
||||||
|
driver: bridge
|
||||||
|
|||||||
@@ -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"]
|
||||||
@@ -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"'
|
||||||
Reference in New Issue
Block a user