From ad8422827dced022c565ee6013016c5a2abaa9ad Mon Sep 17 00:00:00 2001 From: Argiris Deligiannidis Date: Thu, 1 Feb 2024 19:56:27 +0200 Subject: [PATCH] Create docker image --- .drone.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 15 +++++++++++++++ README.md | 25 ++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..68bac67 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,45 @@ +kind: pipeline +type: docker +name: default + +steps: + - name: build_and_publish_tag + image: plugins/docker:linux-amd64 + settings: + force_tag: true + password: + from_secret: docker_password + registry: git.argideli.com + repo: git.argideli.com/quertex/docker-win-pyinstaller + context: . + dockerfile: ./Dockerfile + username: + from_secret: docker_username + tags: + - latest + - ${DRONE_TAG} + - ${DRONE_SEMVER_MAJOR}.${DRONE_SEMVER_MINOR} + when: + event: + - tag + + - name: build_and_publish + image: plugins/docker:linux-amd64 + settings: + force_tag: true + password: + from_secret: docker_password + registry: git.argideli.com + repo: git.argideli.com/quertex/docker-win-pyinstaller + context: . + dockerfile: ./Dockerfile + username: + from_secret: docker_username + tags: + - latest + when: + branch: + - main + event: + - push + - cron diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b465e8b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM alpine:latest + +ARG PYTHON_VERSION=3.11.7 +ARG PYTHON_URL=https://www.python.org/ftp/python/${PYTHON_VERSION}/python-3.11.7.exe +ENV WINEDEBUG=fixme-all + +RUN \ + apk -U add wine && \ + for i in core dev exe lib path pip ; do \ + wget -O "/tmp/python_$i.msi" -c "https://www.python.org/ftp/python/${PYTHON_VERSION}/win32/$i.msi" ; \ + wine msiexec /i "/tmp/python_$i.msi" /qb TARGETDIR=C:/python && \ + rm "/tmp/python_$i.msi" ; \ + done && \ + wine c:/python/python.exe -m pip install pyinstaller && \ + mkdir -p /src /out diff --git a/README.md b/README.md index 1079381..1b5a18d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ -# docker-win-pyinstaller +# wine python windows builder +Python for windows container. + +## usage + +example `.drone.yaml`: + +```yaml +kind: pipeline +type: docker +name: default + +steps: + - name: build + image: docker.asperti.com/paspo/python-windows-builder + pull: always + commands: + # add dependancy + - wine c:/python/python.exe -m pip install cryptography + # prepare output directory + - mkdir -p /drone/src/out/ + # build + - wine c:/python/Scripts/pyinstaller.exe --onefile --distpath z:/drone/src/out z:/drone/src/prepara_xml.py +```