├── Dockerfile ├── LICENSE ├── README.md ├── docker-compose.yml ├── dot_profile_skcom ├── rebuild.sh ├── reset.sh ├── supervisord-bg.conf ├── supervisord-fg.conf ├── synctime.ps1 ├── tested ├── Dockerfile.deb ├── Dockerfile.kyle ├── Dockerfile.u18 ├── Dockerfile.u19 ├── Dockerfile.u20 └── Dockerfile.win10 └── waitproc.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:eoan 2 | 3 | # 套件庫切換到國網中心 4 | 5 | RUN sed -i 's/\(security\|archive\).ubuntu.com/free.nchc.org.tw/' /etc/apt/sources.list && \ 6 | dpkg --add-architecture i386 && \ 7 | apt-get update 8 | 9 | # 設定時區 10 | 11 | RUN export DEBIAN_FRONTEND=noninteractive && \ 12 | apt-get install tzdata && \ 13 | ln -fs /usr/share/zoneinfo/Asia/Taipei /etc/localtime && \ 14 | dpkg-reconfigure -f noninteractive tzdata 15 | 16 | # 安裝 Wine 以外的套件 17 | 18 | RUN apt-get install -y \ 19 | wget gnupg2 supervisor software-properties-common \ 20 | xvfb x11vnc xdotool icewm \ 21 | cabextract vim 22 | 23 | # 安裝 Wine Stable 24 | 25 | RUN wget -nv -O - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - && \ 26 | add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ eoan main' && \ 27 | apt-get update && \ 28 | apt-get install -y winehq-stable 29 | 30 | # skbot 使用者設定 31 | 32 | RUN useradd -m -r -p "" -s /bin/bash skbot && \ 33 | su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-mono/4.9.4/wine-mono-4.9.4.msi' && \ 34 | su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-gecko/2.47.1/wine-gecko-2.47.1-x86.msi' && \ 35 | su -l skbot -c 'wget -nv https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks' && \ 36 | su -l skbot -c 'mkdir -p .cache/wine' && \ 37 | su -l skbot -c 'mv *.msi .cache/wine' && \ 38 | su -l skbot -c 'chmod +x winetricks' && \ 39 | su -l skbot -c 'mkdir .vnc' && \ 40 | su -l skbot -c 'x11vnc -storepasswd 0000 .vnc/passwd' 41 | 42 | # 置入設定檔與工具腳本 43 | 44 | ADD supervisord-bg.conf /root/supervisord-bg.conf 45 | ADD supervisord-fg.conf /root/supervisord-fg.conf 46 | ADD waitproc.sh /root/waitproc.sh 47 | ADD dot_profile_skcom /home/skbot/.profile_skcom 48 | RUN chmod +x /root/waitproc.sh && \ 49 | chmod 644 /home/skbot/.profile_skcom && \ 50 | chown skbot:skbot /home/skbot/.profile_skcom && \ 51 | su -l skbot -c 'echo source $HOME/.profile_skcom >> .profile' 52 | 53 | # 建置 wine 環境 54 | # 注意!! wineboot --init 執行完後, 需要等 wineserver 關閉, 之後才能正常運作 55 | 56 | RUN supervisord -c /root/supervisord-bg.conf && \ 57 | /root/waitproc.sh icewm started 1 && \ 58 | echo "Initialize wine environment for user skbot ..." && \ 59 | su -l skbot -c 'wineboot --init' 2> /dev/null && \ 60 | /root/waitproc.sh wineserver terminated 3 && \ 61 | su -l skbot -c 'wget -nv https://www.python.org/ftp/python/3.8.3/python-3.8.3.exe' && \ 62 | su -l skbot -c 'wine python-3.8.3.exe /passive' 2> /dev/null && \ 63 | kill `cat /root/supervisord.pid` && \ 64 | /root/waitproc.sh supervisord terminated 1 65 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 tacosync 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 實驗階段用 script 2 | 3 | ``` 4 | docker build -t skbot:sandbox . 5 | docker run --name skbot-0 -p 5900:5900 -it skbot:sandbox 6 | docker start -i skbot-0 7 | docker rm skbot-0 8 | ``` 9 | 10 | # 作業系統選擇問題 11 | 12 | Wine 並不是在所有系統都能順利運作, 有些疑難問題需要用特殊手段才排解, 需要消耗大量時間
13 | 現階段用 Ubuntu 19.10 是最佳選擇 14 | 15 | 系統 | 實際狀況 16 | ------------------------|-------------------------------------------------------------------- 17 | Ubuntu 19.10 eoan | 可以順利安裝 18 | Ubuntu 20.04 LTS focal | PPA 提供的 winehq-stable 只到 4.0.4 版, 後續安裝 mono 與 gecko 會失敗 19 | Ubuntu 18.04 LTS bionic | 需要先自行安裝 libfaudio 套件 20 | Debian 10 buster | 需要先自行安裝 libfaudio 套件 21 | 22 | ## Debian, Ubuntu 18 遇到的問題 23 | 24 | ``` 25 | The following packages have unmet dependencies: 26 | winehq-stable : Depends: wine-stable (= 5.0.0~buster) 27 | E: Unable to correct problems, you have held broken packages. 28 | ``` 29 | 30 | ## Ubuntu 20 遇到的問題 31 | 32 | 安裝 wine-mono 與 wine-gecko 會出現 1603 的錯誤碼, 然後再安裝其他軟體都會意外中斷
33 | 去 PPA 的網站查, 發現版本只提供到 4.0.4 34 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.0" 2 | services: 3 | skcom: 4 | build: . 5 | environment: 6 | - DISPLAY=:0 7 | - WINEARCH=win32 8 | ports: 9 | - 5900:5900 10 | command: 11 | - /usr/bin/supervisord 12 | -------------------------------------------------------------------------------- /dot_profile_skcom: -------------------------------------------------------------------------------- 1 | export DISPLAY=:0 2 | export WINEARCH=win32 3 | export PATH=$PATH:/opt/wine-stable/bin 4 | export WINPY='C:\users\skbot\local settings\application data\programs\python\python38-32' 5 | export WINEPATH="$WINPY;$WINPY\\scripts" 6 | export WINEDEBUG=-all 7 | -------------------------------------------------------------------------------- /rebuild.sh: -------------------------------------------------------------------------------- 1 | docker rm skbot-0 2 | #docker rmi skbot:sandbox 3 | docker build -t skbot:sandbox . 4 | #docker build --no-cache -t skbot:sandbox . 5 | -------------------------------------------------------------------------------- /reset.sh: -------------------------------------------------------------------------------- 1 | docker rm skbot-0 2 | winpty docker run --name skbot-0 -p 5900:5900 -it skbot:sandbox 3 | -------------------------------------------------------------------------------- /supervisord-bg.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | #nodaemon = true 3 | user = root 4 | pidfile = /root/supervisord.pid 5 | environment = WINEARCH="win32",DISPLAY=":0" 6 | 7 | [program:X11] 8 | command = /usr/bin/Xvfb :0 -screen 0 800x600x16 9 | priority = 1 10 | autorestart = true 11 | user = skbot 12 | stdout_logfile = /dev/fd/1 13 | stdout_logfile_maxbytes = 0 14 | redirect_stderr = true 15 | 16 | [program:icewm] 17 | # 注意!! 18 | # 需要使用 su -l 的方式切換, 否則開啟 terminal 會有使用者錯亂問題 19 | command = su -l skbot -c '/usr/bin/icewm' 20 | priority = 2 21 | autorestart = true 22 | directory = /home/skbot 23 | stdout_logfile = /dev/fd/1 24 | stdout_logfile_maxbytes = 0 25 | redirect_stderr = true 26 | 27 | [program:x11vnc] 28 | command = /usr/bin/x11vnc -noxrecord -rfbauth /home/skbot/.vnc/passwd 29 | priority = 3 30 | autorestart = false 31 | user = skbot 32 | stdout_logfile = /dev/fd/1 33 | stdout_logfile_maxbytes = 0 34 | redirect_stderr = true 35 | -------------------------------------------------------------------------------- /supervisord-fg.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon = true 3 | user = root 4 | pidfile = /root/supervisord.pid 5 | environment = WINEARCH="win32",DISPLAY=":0" 6 | 7 | [program:X11] 8 | command = /usr/bin/Xvfb :0 -screen 0 800x600x16 9 | priority = 1 10 | autorestart = true 11 | user = skbot 12 | stdout_logfile = /dev/fd/1 13 | stdout_logfile_maxbytes = 0 14 | redirect_stderr = true 15 | 16 | [program:icewm] 17 | # 注意!! 18 | # 需要使用 su -l 的方式切換, 否則開啟 terminal 會有使用者錯亂問題 19 | command = su -l skbot -c '/usr/bin/icewm' 20 | priority = 2 21 | autorestart = true 22 | directory = /home/skbot 23 | stdout_logfile = /dev/fd/1 24 | stdout_logfile_maxbytes = 0 25 | redirect_stderr = true 26 | 27 | [program:x11vnc] 28 | command = /usr/bin/x11vnc -noxrecord -rfbauth /home/skbot/.vnc/passwd 29 | priority = 3 30 | autorestart = false 31 | user = skbot 32 | stdout_logfile = /dev/fd/1 33 | stdout_logfile_maxbytes = 0 34 | redirect_stderr = true 35 | -------------------------------------------------------------------------------- /synctime.ps1: -------------------------------------------------------------------------------- 1 | Disable-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 2 | Enable-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 3 | Get-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 4 | -------------------------------------------------------------------------------- /tested/Dockerfile.deb: -------------------------------------------------------------------------------- 1 | FROM debian:latest 2 | 3 | # Debian 已經預先裝好 tzdata, 不需要跑 apt-get install tzdata 4 | # 所以可以開機時直接變更時區, 不需要先更新套件清單 5 | RUN export DEBIAN_FRONTEND=noninteractive && \ 6 | ln -fs /usr/share/zoneinfo/Asia/Taipei /etc/localtime && \ 7 | dpkg-reconfigure -f noninteractive tzdata 8 | 9 | # http://security.debian.org 沒有鏡像到國網中心, 這點要注意 10 | RUN sed -i 's/deb.debian.org/free.nchc.org.tw/' /etc/apt/sources.list && \ 11 | dpkg --add-architecture i386 && \ 12 | apt-get update 13 | 14 | # 照這篇來裝 https://wiki.debian.org/Wine 15 | RUN apt-get install -y \ 16 | wget supervisor procps cabextract vim \ 17 | xvfb x11vnc xdotool \ 18 | wine wine32 wine64 libwine libwine:i386 fonts-wine 19 | 20 | # 建立一個 skbot 使用者, 設定需要的環境變數 21 | RUN useradd -m -r -p "" -s /bin/bash skbot && \ 22 | su -l skbot -c 'echo "" >> .bashrc' && \ 23 | su -l skbot -c 'echo "export DISPLAY=:0" >> .bashrc' && \ 24 | su -l skbot -c 'echo "export WINEARCH=win32" >> .bashrc' && \ 25 | su -l skbot -c 'wget -nv https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks' && \ 26 | su -l skbot -c 'chmod +x winetricks' 27 | 28 | # 隨便設定 VNC 密碼 29 | RUN su -l skbot -c 'mkdir .vnc' && \ 30 | su -l skbot -c 'x11vnc -storepasswd 0000 .vnc/passwd' 31 | 32 | # 變更 supervisord 設定 33 | ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf 34 | ADD supervisord.conf /root/supervisord.conf 35 | 36 | # JWM Window Manager 37 | # 跟其他 X Server 相關套件分開安裝, 方便切換 38 | RUN apt-get install -y icewm 39 | -------------------------------------------------------------------------------- /tested/Dockerfile.kyle: -------------------------------------------------------------------------------- 1 | FROM ubuntu:eoan 2 | 3 | ENV HOME /root 4 | ENV DEBIAN_FRONTEND noninteractive 5 | ENV LC_ALL C.UTF-8 6 | ENV LANG en_US.UTF-8 7 | ENV LANGUAGE en_US.UTF-8 8 | 9 | RUN sed -i 's/\(security\|archive\).ubuntu.com/free.nchc.org.tw/' /etc/apt/sources.list && \ 10 | dpkg --add-architecture i386 && \ 11 | apt-get update 12 | 13 | RUN apt-get -y install xvfb x11vnc xdotool wget tar supervisor net-tools fluxbox gnupg2 14 | RUN wget -O - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - 15 | RUN echo 'deb https://dl.winehq.org/wine-builds/ubuntu/ eoan main' |tee /etc/apt/sources.list.d/winehq.list 16 | RUN apt-get update && apt-get -y install winehq-stable 17 | RUN mkdir /opt/wine-stable/share/wine/mono && \ 18 | wget -O - https://dl.winehq.org/wine/wine-mono/4.9.4/wine-mono-bin-4.9.4.tar.gz |tar -xzv -C /opt/wine-stable/share/wine/mono 19 | RUN mkdir /opt/wine-stable/share/wine/gecko && \ 20 | wget -O /opt/wine-stable/share/wine/gecko/wine-gecko-2.47.1-x86.msi https://dl.winehq.org/wine/wine-gecko/2.47.1/wine-gecko-2.47.1-x86.msi && \ 21 | wget -O /opt/wine-stable/share/wine/gecko/wine-gecko-2.47.1-x86_64.msi https://dl.winehq.org/wine/wine-gecko/2.47.1/wine-gecko-2.47.1-x86_64.msi 22 | RUN apt-get -y full-upgrade && apt-get clean 23 | ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf 24 | 25 | ENV WINEPREFIX /root/prefix32 26 | ENV WINEARCH win32 27 | ENV DISPLAY :0 28 | 29 | WORKDIR /root/ 30 | EXPOSE 5900 31 | -------------------------------------------------------------------------------- /tested/Dockerfile.u18: -------------------------------------------------------------------------------- 1 | FROM ubuntu:bionic 2 | 3 | # 先把套件庫切換到國網中心加速 4 | # ========================== 5 | # 注意!! 如果這一段在 DockerDesktop for Windows 發生下列問題 6 | # 7 | # E: Release file for http://free.nchc.org.tw/ubuntu/dists/focal-updates/InRelease 8 | # is not valid yet (invalid for another 7h 52min 41s). 9 | # Updates for this repository will not be applied. 10 | # 11 | # 表示用於跑 Docker 的虛擬機器沒有校正時間, 需要調整 Hyper-V 的設定修正這個問題 12 | # 13 | # Get-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 14 | # Disable-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 15 | # Enable-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 16 | # 17 | # 注意大部分文件寫的參數是 "Time Synchronization", 18 | # 但是在中文 Windows 務必要用中文參數名稱 "時間同步化" (幹! 又是正版軟體受害者) 19 | # 20 | # 參考文件: https://thorsten-hans.com/docker-on-windows-fix-time-synchronization-issue 21 | 22 | RUN sed -i 's/\(security\|archive\).ubuntu.com/free.nchc.org.tw/' /etc/apt/sources.list && \ 23 | dpkg --add-architecture i386 && \ 24 | apt-get update 25 | 26 | # 搞定時區問題 27 | # =========== 28 | # 安裝 software-properties-common 會互動式詢問時區設定, 先處理好就沒事 29 | 30 | RUN export DEBIAN_FRONTEND=noninteractive && \ 31 | apt-get install tzdata && \ 32 | ln -fs /usr/share/zoneinfo/Asia/Taipei /etc/localtime && \ 33 | dpkg-reconfigure -f noninteractive tzdata 34 | 35 | # 安裝相依套件 36 | # =========== 37 | 38 | RUN apt-get install -y \ 39 | wget gnupg2 supervisor software-properties-common \ 40 | xvfb x11vnc xdotool \ 41 | cabextract vim 42 | 43 | # 增加 WineHQ 的 PPA 44 | # ======================= 45 | # 這裡需要用到 wget gnupg2 46 | 47 | RUN wget -O - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - 48 | 49 | # 安裝 Wine Stable 50 | # ================ 51 | # 這裡需要用到 software-properties-common 52 | # apt-get install -y --install-recommends winehq-stable 53 | 54 | RUN add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main' && \ 55 | apt-get update && \ 56 | apt-get install -y winehq-stable 57 | 58 | # JWM Window Manager 59 | # 跟其他 X Server 相關套件分開安裝, 方便切換 60 | RUN apt-get install -y icewm 61 | 62 | # 建立一個 skbot 使用者, 設定需要的環境變數 63 | RUN useradd -m -r -p "" -s /bin/bash skbot && \ 64 | su -l skbot -c 'echo "" >> .bashrc' && \ 65 | su -l skbot -c 'echo "export DISPLAY=:0" >> .bashrc' && \ 66 | su -l skbot -c 'echo "export WINEARCH=win32" >> .bashrc' 67 | 68 | # 預載 winboot 會靠妖的套件 69 | # ======================== 70 | # 這些需要實驗是否可以在 wineboot 執行前先預裝好 71 | # 假如實驗無效, 那就需要用 xdotool 模擬人工安裝, 或是乾脆按不裝 72 | # 注意!! mono 與 gecko 的版本必須要匹配 wine stable 才有作用, 否則還是會進入互動式安裝 73 | # 不過假如下載流程沒進行 MD5 驗證的話, 也許可以用改檔名的方式騙過去 74 | 75 | RUN su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-mono/4.7.5/wine-mono-4.7.5.msi' && \ 76 | su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86.msi' && \ 77 | su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86_64.msi' && \ 78 | su -l skbot -c 'wget -nv https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks' && \ 79 | su -l skbot -c 'mkdir -p .cache/wine' && \ 80 | su -l skbot -c 'mv *.msi .cache/wine' && \ 81 | su -l skbot -c 'chmod +x winetricks' 82 | 83 | # 隨便設定 VNC 密碼 84 | RUN su -l skbot -c 'mkdir .vnc' && \ 85 | su -l skbot -c 'x11vnc -storepasswd 0000 .vnc/passwd' 86 | 87 | # 變更 supervisord 設定 88 | ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf 89 | ADD supervisord.conf /root/supervisord.conf 90 | -------------------------------------------------------------------------------- /tested/Dockerfile.u19: -------------------------------------------------------------------------------- 1 | FROM ubuntu:eoan 2 | 3 | # 先把套件庫切換到國網中心加速 4 | # ========================== 5 | # 注意!! 如果這一段在 DockerDesktop for Windows 發生下列問題 6 | # 7 | # E: Release file for http://free.nchc.org.tw/ubuntu/dists/focal-updates/InRelease 8 | # is not valid yet (invalid for another 7h 52min 41s). 9 | # Updates for this repository will not be applied. 10 | # 11 | # 表示用於跑 Docker 的虛擬機器沒有校正時間, 需要調整 Hyper-V 的設定修正這個問題 12 | # 13 | # Get-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 14 | # Disable-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 15 | # Enable-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 16 | # 17 | # 注意大部分文件寫的參數是 "Time Synchronization", 18 | # 但是在中文 Windows 務必要用中文參數名稱 "時間同步化" (幹! 又是正版軟體受害者) 19 | # 20 | # 參考文件: https://thorsten-hans.com/docker-on-windows-fix-time-synchronization-issue 21 | 22 | RUN sed -i 's/\(security\|archive\).ubuntu.com/free.nchc.org.tw/' /etc/apt/sources.list && \ 23 | dpkg --add-architecture i386 && \ 24 | apt-get update 25 | 26 | # 搞定時區問題 27 | # =========== 28 | # 安裝 software-properties-common 會互動式詢問時區設定, 先處理好就沒事 29 | 30 | RUN export DEBIAN_FRONTEND=noninteractive && \ 31 | apt-get install tzdata && \ 32 | ln -fs /usr/share/zoneinfo/Asia/Taipei /etc/localtime && \ 33 | dpkg-reconfigure -f noninteractive tzdata 34 | 35 | # 安裝相依套件 36 | # =========== 37 | 38 | RUN apt-get install -y \ 39 | wget gnupg2 supervisor software-properties-common 40 | 41 | # 增加 WineHQ 的 PPA 42 | # ======================= 43 | # 這裡需要用到 wget gnupg2 44 | 45 | RUN wget -O - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - 46 | 47 | # 安裝 Wine Stable 48 | # ================ 49 | # 這裡需要用到 software-properties-common 50 | # apt-get install -y --install-recommends winehq-stable 51 | 52 | RUN add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ eoan main' && \ 53 | apt-get update && \ 54 | apt-get install -y winehq-stable 55 | 56 | # 安裝虛擬 X Server 環境 57 | RUN apt-get install -y xvfb x11vnc xdotool 58 | 59 | # JWM Window Manager 60 | # 跟其他 X Server 相關套件分開安裝, 方便切換 61 | RUN apt-get install -y icewm 62 | 63 | # 建立一個 skbot 使用者, 設定需要的環境變數 64 | RUN useradd -m -r -p "" -s /bin/bash skbot && \ 65 | su -l skbot -c 'echo "" >> .bashrc' && \ 66 | su -l skbot -c 'echo "export DISPLAY=:0" >> .bashrc' && \ 67 | su -l skbot -c 'echo "export WINEARCH=win32" >> .bashrc' 68 | 69 | # 預載 winboot 會靠妖的套件 70 | # ======================== 71 | # 這些需要實驗是否可以在 wineboot 執行前先預裝好 72 | # 假如實驗無效, 那就需要用 xdotool 模擬人工安裝, 或是乾脆按不裝 73 | # 注意!! mono 與 gecko 的版本必須要匹配 wine stable 才有作用, 否則還是會進入互動式安裝 74 | # 不過假如下載流程沒進行 MD5 驗證的話, 也許可以用改檔名的方式騙過去 75 | 76 | RUN su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-mono/4.7.5/wine-mono-4.7.5.msi' && \ 77 | su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86.msi' && \ 78 | # su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86_64.msi' && \ 79 | su -l skbot -c 'wget -nv https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks' && \ 80 | su -l skbot -c 'mkdir -p .cache/wine' && \ 81 | su -l skbot -c 'mv *.msi .cache/wine' && \ 82 | su -l skbot -c 'chmod +x winetricks' 83 | 84 | # 解壓縮 cab 用 85 | RUN apt-get install -y cabextract vim 86 | 87 | # 隨便設定 VNC 密碼 88 | RUN su -l skbot -c 'mkdir .vnc' && \ 89 | su -l skbot -c 'x11vnc -storepasswd 0000 .vnc/passwd' 90 | 91 | # 變更 supervisord 設定 92 | ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf 93 | ADD supervisord.conf /root/supervisord.conf 94 | -------------------------------------------------------------------------------- /tested/Dockerfile.u20: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal 2 | 3 | # 先把套件庫切換到國網中心加速 4 | # ========================== 5 | # 注意!! 如果這一段在 DockerDesktop for Windows 發生下列問題 6 | # 7 | # E: Release file for http://free.nchc.org.tw/ubuntu/dists/focal-updates/InRelease 8 | # is not valid yet (invalid for another 7h 52min 41s). 9 | # Updates for this repository will not be applied. 10 | # 11 | # 表示用於跑 Docker 的虛擬機器沒有校正時間, 需要調整 Hyper-V 的設定修正這個問題 12 | # 13 | # Get-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 14 | # Disable-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 15 | # Enable-VMIntegrationService -VMName "DockerDesktopVM" -Name "時間同步化" 16 | # 17 | # 注意大部分文件寫的參數是 "Time Synchronization", 18 | # 但是在中文 Windows 務必要用中文參數名稱 "時間同步化" (幹! 又是正版軟體受害者) 19 | # 20 | # 參考文件: https://thorsten-hans.com/docker-on-windows-fix-time-synchronization-issue 21 | 22 | RUN sed -i 's/\(security\|archive\).ubuntu.com/free.nchc.org.tw/' /etc/apt/sources.list && \ 23 | dpkg --add-architecture i386 && \ 24 | apt-get update 25 | 26 | # 搞定時區問題 27 | # =========== 28 | # 安裝 software-properties-common 會互動式詢問時區設定, 先處理好就沒事 29 | 30 | RUN export DEBIAN_FRONTEND=noninteractive && \ 31 | apt-get install tzdata && \ 32 | ln -fs /usr/share/zoneinfo/Asia/Taipei /etc/localtime && \ 33 | dpkg-reconfigure -f noninteractive tzdata 34 | 35 | # 安裝相依套件 36 | # =========== 37 | 38 | RUN apt-get install -y \ 39 | wget gnupg2 supervisor software-properties-common \ 40 | xvfb x11vnc xdotool \ 41 | cabextract vim 42 | 43 | # 增加 WineHQ 的 PPA 44 | # ======================= 45 | # 這裡需要用到 wget gnupg2 46 | 47 | RUN wget -O - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - 48 | 49 | # 安裝 Wine Stable 50 | # ================ 51 | # 這裡需要用到 software-properties-common 52 | # apt-get install -y --install-recommends winehq-stable 53 | 54 | RUN add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' && \ 55 | apt-get update && \ 56 | apt-get install -y winehq-stable 57 | 58 | # JWM Window Manager 59 | # 跟其他 X Server 相關套件分開安裝, 方便切換 60 | RUN apt-get install -y icewm 61 | 62 | # 建立一個 skbot 使用者, 設定需要的環境變數 63 | RUN useradd -m -r -p "" -s /bin/bash skbot && \ 64 | su -l skbot -c 'echo "" >> .bashrc' && \ 65 | su -l skbot -c 'echo "export DISPLAY=:0" >> .bashrc' && \ 66 | su -l skbot -c 'echo "export WINEARCH=win32" >> .bashrc' 67 | 68 | # 預載 winboot 會靠妖的套件 69 | # ======================== 70 | # 這些需要實驗是否可以在 wineboot 執行前先預裝好 71 | # 假如實驗無效, 那就需要用 xdotool 模擬人工安裝, 或是乾脆按不裝 72 | # 注意!! mono 與 gecko 的版本必須要匹配 wine stable 才有作用, 否則還是會進入互動式安裝 73 | # 不過假如下載流程沒進行 MD5 驗證的話, 也許可以用改檔名的方式騙過去 74 | 75 | RUN su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-mono/4.7.5/wine-mono-4.7.5.msi' && \ 76 | su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86.msi' && \ 77 | # su -l skbot -c 'wget -nv https://dl.winehq.org/wine/wine-gecko/2.47/wine_gecko-2.47-x86_64.msi' && \ 78 | su -l skbot -c 'wget -nv https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks' && \ 79 | su -l skbot -c 'mkdir -p .cache/wine' && \ 80 | su -l skbot -c 'mv *.msi .cache/wine' && \ 81 | su -l skbot -c 'chmod +x winetricks' 82 | 83 | # 隨便設定 VNC 密碼 84 | RUN su -l skbot -c 'mkdir .vnc' && \ 85 | su -l skbot -c 'x11vnc -storepasswd 0000 .vnc/passwd' 86 | 87 | # 變更 supervisord 設定 88 | ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf 89 | ADD supervisord.conf /root/supervisord.conf 90 | -------------------------------------------------------------------------------- /tested/Dockerfile.win10: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/windows:2004 2 | RUN curl -L -o C:\pythoninstaller.exe https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe 3 | RUN powershell -c "Start-Process C:\pythoninstaller.exe -Wait -ArgumentList @( '/passive','InstallAllUsers=1', 'TargetDir=C:\Python', 'PrependPath=1', 'Shortcuts=0','Include_doc=0','Include_pip=1', 'Include_test=0')" 4 | RUN powershell -c "$env:PATH = [Environment]::GetEnvironmentVariable('PATH',[EnvironmentVariableTarget]::Machine)" 5 | RUN powershell -c "python -m pip install --upgrade pip" 6 | RUN powershell -c "python -m pip install skcom" 7 | #RUN powershell -c "python -m skcom.tools.setup" 8 | 9 | CMD ["cmd"] 10 | -------------------------------------------------------------------------------- /waitproc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PROC=$1 4 | ACTION=$2 5 | INTERVAL=$3 6 | 7 | ps -C $PROC > /dev/null 2>&1 8 | RETV=$? 9 | if [ $ACTION == "started" ]; then 10 | while [ $RETV -ne 0 ]; do 11 | echo "Waiting for $PROC started." 12 | sleep $INTERVAL 13 | ps -C $PROC > /dev/null 2>&1 14 | RETV=$? 15 | done 16 | else 17 | while [ $RETV -eq 0 ]; do 18 | echo "Waiting for $PROC terminated." 19 | sleep $INTERVAL 20 | ps -C $PROC > /dev/null 2>&1 21 | RETV=$? 22 | done 23 | fi 24 | --------------------------------------------------------------------------------