GithubHelp home page GithubHelp logo

scimax / python-core-windows Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lbates2000/python-windows

0.0 2.0 0.0 118.83 MB

Python 3.6.0 and PIP 9.0.1 running in a Window Nano Server Docker container

Dockerfile 100.00%

python-core-windows's Introduction

python-core-windows

Windows Server Core container running python 3.6.0 and pip 9.0.1. The docker image is based on the Windows Nano Server for python by lbates2000. The nano server was replaced with the server core container as the ctypes library for foreign functions does not work properly.

Issue with the nano server

The following snippet is a minimum code required to reproduce the problem based on __init__.py in the comtypes module:

from ctypes import *
import sys
COINIT_APARTMENTTHREADED = 0x2
_ole32 = oledll.ole32
flags = getattr(sys, "coinit_flags", COINIT_APARTMENTTHREADED)
_ole32.CoInitializeEx(None, flags)

The traceback reports

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_ctypes/callproc.c", line 918, in GetResult
OSError: [WinError -2147467263] Not implemented

Unfortunately, using the windows core server instead of the nano server blows up the size of the container by 10GB. But ctypes works with this container base.

Build

After cloning the repository from github run:

docker build -t python-core-windows .

Usage

This was built by installing Python on a Windows 10 x64 machine and then copying the installation to the container and setting the python path.

You can run it interactively

docker run -it python-windows

or you can use it as a base for another container, as well as upgrade PIP and install additional Python modules, by adding the appropriate commands to the new container's Dockerfile.

For example:

FROM python-windows:latest

ENV APP_DIR C:/apps
ADD requirements.txt $APP_DIR/requirements.txt
WORKDIR $APP_DIR

RUN \
	python -m pip install --upgrade pip && \
	python -m pip install -r requirements.txt

ENTRYPOINT ["C:\\Python\\python.exe"]

Container is hosted on Docker Hub:

https://hub.docker.com/r/scimax/python-core-windows/

docker pull scimax/python-core-windows

python-core-windows's People

Contributors

scimax avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.