| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| FROM ubuntu:22.04 |
|
|
| ENV DEBIAN_FRONTEND=noninteractive \ |
| WINEARCH=win64 \ |
| WINEPREFIX=/root/.wine \ |
| DISPLAY=:99 |
|
|
| |
| RUN dpkg --add-architecture i386 && \ |
| apt-get update && \ |
| apt-get install -y --no-install-recommends \ |
| wget gnupg2 software-properties-common ca-certificates \ |
| xvfb x11vnc supervisor cabextract unzip winbind \ |
| python3 python3-pip curl && \ |
| wget -nc https://dl.winehq.org/wine-builds/winehq.key -O /usr/share/keyrings/winehq-archive.key && \ |
| echo "deb [signed-by=/usr/share/keyrings/winehq-archive.key] https://dl.winehq.org/wine-builds/ubuntu/ jammy main" \ |
| > /etc/apt/sources.list.d/winehq.list && \ |
| apt-get update && \ |
| apt-get install -y --no-install-recommends winehq-stable && \ |
| rm -rf /var/lib/apt/lists/* |
| |
| # --- Install uv (for the Linux-side bot process) --- |
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh |
| ENV PATH="/root/.local/bin:${PATH}" |
| |
| # --- Initialize the Wine prefix --- |
| RUN wineboot --init && sleep 5 |
| |
| # --- Install Python for Windows, inside Wine --- |
| # Pin a version known to work with the MetaTrader5 Windows package. |
| RUN wget -q https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe -O /tmp/wine-python.exe && \ |
| xvfb-run -a wine /tmp/wine-python.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 && \ |
| rm /tmp/wine-python.exe |
| |
| # --- Install MetaTrader5 + mt5linux server package inside Wine-Python --- |
| RUN xvfb-run -a wine python -m pip install --upgrade pip && \ |
| xvfb-run -a wine python -m pip install MetaTrader5 mt5linux |
| |
| # --- App code --- |
| # The mt5_terminal/ directory is NOT copied here β it's uploaded separately |
| # via Git LFS using scripts/upload_to_hf.py --mt5 to keep image builds fast. |
| # At runtime the HF Space will have mt5_terminal/ at /app/mt5_terminal/. |
| WORKDIR /app |
| COPY . /app |
| RUN uv sync --extra linux-wine |
| |
| # --- Supervisor config (Xvfb, VNC, wine MT5 terminal, mt5linux server, bot) --- |
| COPY docker/supervisord.conf /etc/supervisor/conf.d/wickbot.conf |
| |
| EXPOSE 5900 8000 |
| |
| # Default WEBAPP_PORT=8000 matches .env.example. HF Spaces overrides this |
| # via its Space Settings β Variables (the convention on HF is 7860). |
| ENV MT5_BACKEND=linux \ |
| MT5LINUX_HOST=localhost \ |
| MT5LINUX_PORT=18812 \ |
| WEBAPP_HOST=0.0.0.0 \ |
| WEBAPP_PORT=8000 \ |
| HF_APP_PORT=7860 |
| |
| CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/wickbot.conf"] |
| |