diff --git a/Dockerfile b/Dockerfile index ffe7007..ae66d78 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,41 +1,37 @@ -FROM ubuntu:20.04 +FROM i386/debian:buster-slim ENV DEBIAN_FRONTEND noninteractive ENV LC_ALL C.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 -ENV WINEPREFIX /root/wine +ENV WINEPREFIX /root/.wine ENV WINEARCH win32 ENV WINEDEBUG -all ARG PYTHON_VERSION=3.10.8 -#Install Tool RUN apt-get update \ - && apt-get install -y --install-recommends \ - software-properties-common \ - wget \ - xvfb - -#Intall Wine -COPY wine-init.sh / - -RUN wget -nv -O- https://dl.winehq.org/wine-builds/winehq.key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://dl.winehq.org/wine-builds/ubuntu/ $(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2) main" >> /etc/apt/sources.list \ + && apt-get install -y --install-recommends ca-certificates gnupg wget xvfb \ + && wget -nv -O- https://dl.winehq.org/wine-builds/winehq.key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://dl.winehq.org/wine-builds/debian/ $(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2) main" >> /etc/apt/sources.list \ && dpkg --add-architecture i386 \ && apt-get update \ - && apt-get install -y --no-install-recommends winehq-stable \ + && apt-get install -y --no-install-recommends --no-install-suggests winehq-stable \ && rm -rf /var/lib/apt/lists/* \ - && xvfb-run sh wine-init.sh - -#Install python for Windows -RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}.exe -O python.exe \ + && xvfb-run sh -c "\ + set -e; \ + export WINEDLLOVERRIDES="winemenubuilder.exe,mscoree,mshtml="; \ + wine reg add 'HKLM\Software\Microsoft\Windows NT\CurrentVersion' /v CurrentVersion /d 10.0 /f; \ + wine reg add 'HKCU\Software\Wine\DllOverrides' /v winemenubuilder.exe /t REG_SZ /d '' /f; \ + wine reg add 'HKCU\Software\Wine\DllOverrides' /v mscoree /t REG_SZ /d '' /f; \ + wine reg add 'HKCU\Software\Wine\DllOverrides' /v mshtml /t REG_SZ /d '' /f; \ + wineserver -w" \ + && wget https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}.exe -O python.exe \ && xvfb-run sh -c "\ wine python.exe /quiet TargetDir=C:\\Python \ Include_doc=0 InstallAllUsers=1 PrependPath=1; \ wineserver -w" \ - && rm python.exe - -#Clear -RUN apt-get autoremove -y --purge software-properties-common wget \ + && rm python.exe \ + && apt-get autoremove -y --purge ca-certificates gnupg wget \ + && apt-get autoremove -y --purge \ && apt-get clean -y diff --git a/README.md b/README.md index 740e1a1..be790b1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Docker is easy to deploy in any environment, such as the Paas Wine Some programs must be executed under Windows Python is a very easy to use and popular programming language -For `Python 3.10.8 32bit for Windows` only +For `Python 3.10.8 32bit for Windows` only, minimum image for python runtime!!! Does not include the full Windows environment @@ -31,11 +31,11 @@ wine python ... #### Install requirements by pip ```shell xvfb-run sh -c "\ - wine pip install -r requirements.txt; \ + wine pip install --no-cache-dir -r requirements.txt; \ wineserver -w" ``` ### Copyright --- -MIT © [bitjerry](https://github.com/bitjerry/wine-python/blob/main/LICENSE) \ No newline at end of file +MIT © [bitjerry](https://github.com/bitjerry/wine-python/blob/main/LICENSE) diff --git a/README.zh_cn.md b/README.zh_cn.md index 3fc659f..4bc22f8 100644 --- a/README.zh_cn.md +++ b/README.zh_cn.md @@ -11,7 +11,7 @@ Docker 便于将程序快速部署到任何环境中, 包括 Paas 平台 Wine 某些程序必须在 Windows 环境下执行 Python 毫无疑问, 最简单的编程语言 -仅用于 `Python 3.10.8 32bit for Windows` +仅用于 `Python 3.10.8 32bit for Windows`, 最小镜像python运行环境!!! 不包含完整 Windows 环境 如有更多需求请自行修改 Dockerfile @@ -30,11 +30,11 @@ wine python ... #### 使用pip安装依赖 ```shell xvfb-run sh -c "\ - wine pip install -r requirements.txt; \ + wine pip install --no-cache-dir -r requirements.txt; \ wineserver -w" ``` ### 许可 --- -MIT © [bitjerry](./LICENSE) \ No newline at end of file +MIT © [bitjerry](./LICENSE) diff --git a/wine-init.sh b/wine-init.sh deleted file mode 100644 index d2b7047..0000000 --- a/wine-init.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Prepare environment: -# - Set Windows version to 10 -# - Disable menu updates -# - Disable Mono -# - Disable Gecko -set -e - -export WINEDLLOVERRIDES="winemenubuilder.exe,mscoree,mshtml=" -wine reg add 'HKLM\Software\Microsoft\Windows NT\CurrentVersion' /v CurrentVersion /d 10.0 /f -wine reg add 'HKCU\Software\Wine\DllOverrides' /v winemenubuilder.exe /t REG_SZ /d '' /f -wine reg add 'HKCU\Software\Wine\DllOverrides' /v mscoree /t REG_SZ /d '' /f -wine reg add 'HKCU\Software\Wine\DllOverrides' /v mshtml /t REG_SZ /d '' /f -wineserver -w - diff --git a/x64/Dockerfile b/x64/Dockerfile index 3097c1e..b61bb1c 100644 --- a/x64/Dockerfile +++ b/x64/Dockerfile @@ -1,41 +1,37 @@ -FROM ubuntu:20.04 +FROM debian:buster-slim ENV DEBIAN_FRONTEND noninteractive ENV LC_ALL C.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 -ENV WINEPREFIX /root/wine +ENV WINEPREFIX /root/.wine ENV WINEARCH win64 ENV WINEDEBUG -all ARG PYTHON_VERSION=3.10.8 -#Install Tool RUN apt-get update \ - && apt-get install -y --install-recommends \ - software-properties-common \ - wget \ - xvfb - -#Intall Wine -COPY wine-init.sh / - -RUN wget -nv -O- https://dl.winehq.org/wine-builds/winehq.key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ - && echo "deb https://dl.winehq.org/wine-builds/ubuntu/ $(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2) main" >> /etc/apt/sources.list \ + && apt-get install -y --install-recommends ca-certificates gnupg wget xvfb \ + && wget -nv -O- https://dl.winehq.org/wine-builds/winehq.key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \ + && echo "deb https://dl.winehq.org/wine-builds/debian/ $(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2) main" >> /etc/apt/sources.list \ && dpkg --add-architecture i386 \ && apt-get update \ - && apt-get install -y --no-install-recommends winehq-stable \ + && apt-get install -y --no-install-recommends --no-install-suggests winehq-stable \ && rm -rf /var/lib/apt/lists/* \ - && xvfb-run sh wine-init.sh - -#Install python for Windows -RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-amd64.exe -O python.exe \ + && xvfb-run sh -c "\ + set -e; \ + export WINEDLLOVERRIDES="winemenubuilder.exe,mscoree,mshtml="; \ + wine reg add 'HKLM\Software\Microsoft\Windows NT\CurrentVersion' /v CurrentVersion /d 10.0 /f; \ + wine reg add 'HKCU\Software\Wine\DllOverrides' /v winemenubuilder.exe /t REG_SZ /d '' /f; \ + wine reg add 'HKCU\Software\Wine\DllOverrides' /v mscoree /t REG_SZ /d '' /f; \ + wine reg add 'HKCU\Software\Wine\DllOverrides' /v mshtml /t REG_SZ /d '' /f; \ + wineserver -w" \ + && wget https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-amd64.exe -O python.exe \ && xvfb-run sh -c "\ wine python.exe /quiet TargetDir=C:\\Python \ Include_doc=0 InstallAllUsers=1 PrependPath=1; \ wineserver -w" \ - && rm python.exe - -#Clear -RUN apt-get autoremove -y --purge software-properties-common wget \ - && apt-get clean -y + && rm python.exe \ + && apt-get autoremove -y --purge ca-certificates gnupg wget \ + && apt-get autoremove -y --purge \ + && apt-get clean -y \ No newline at end of file diff --git a/x64/README.md b/x64/README.md index bb125f2..2d01f2b 100644 --- a/x64/README.md +++ b/x64/README.md @@ -29,11 +29,11 @@ wine python ... #### Install requirements by pip ```shell xvfb-run sh -c "\ - wine pip install -r requirements.txt; \ + wine pip install --no-cache-dir -r requirements.txt; \ wineserver -w" ``` ### Copyright --- -MIT © [bitjerry](https://github.com/bitjerry/wine-python/blob/main/LICENSE) \ No newline at end of file +MIT © [bitjerry](https://github.com/bitjerry/wine-python/blob/main/LICENSE) diff --git a/x64/wine-init.sh b/x64/wine-init.sh deleted file mode 100644 index d2b7047..0000000 --- a/x64/wine-init.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Prepare environment: -# - Set Windows version to 10 -# - Disable menu updates -# - Disable Mono -# - Disable Gecko -set -e - -export WINEDLLOVERRIDES="winemenubuilder.exe,mscoree,mshtml=" -wine reg add 'HKLM\Software\Microsoft\Windows NT\CurrentVersion' /v CurrentVersion /d 10.0 /f -wine reg add 'HKCU\Software\Wine\DllOverrides' /v winemenubuilder.exe /t REG_SZ /d '' /f -wine reg add 'HKCU\Software\Wine\DllOverrides' /v mscoree /t REG_SZ /d '' /f -wine reg add 'HKCU\Software\Wine\DllOverrides' /v mshtml /t REG_SZ /d '' /f -wineserver -w -