Skip to content

Instantly share code, notes, and snippets.

@dariodip
Created September 21, 2017 09:45
Show Gist options
  • Save dariodip/4e0133eaa8733e4206ccdb48e7af6a90 to your computer and use it in GitHub Desktop.
Save dariodip/4e0133eaa8733e4206ccdb48e7af6a90 to your computer and use it in GitHub Desktop.
Cython in a Docker container
import hello
hello.say_hello_to('Dario')
FROM python:3.6
WORKDIR /app
ADD . /app
RUN pip install -r requirements.txt
RUN python setup.py build_ext --inplace
ENTRYPOINT ["python"]
CMD ["app.py"]
def say_hello_to(name):
print("Hello %s!" % name)
from distutils.core import setup
from Cython.Build import cythonize
setup(
name= 'Hello world',
ext_modules = cythonize("hello.pyx")
)
@dariodip
Copy link
Author

In this gist I wanted to explain a simple solution to run Cython code into a Docker container.
I found many other solutions, but they were too contorted, so I decided to develop my own solution.

@TheNeuronalCoder
Copy link

thank you very much, my friend?

@xxandy
Copy link

xxandy commented Jun 1, 2020

helped me too! thank you!

@amith23
Copy link

amith23 commented Aug 7, 2021

this was super helpful thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment