python-firetv icon indicating copy to clipboard operation
python-firetv copied to clipboard

Dockerfile does not build on armel

Open mhaas opened this issue 6 years ago • 4 comments

Hi,

I just tried building the Dockerfile on my armel box. It fails to build with the following error:

 ---> 7424d653b82a
Step 4/8 : RUN pip --no-cache-dir install --upgrade pip
 ---> Running in 629f7e46aa78
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 7, in <module>
    from pip import main
  File "/usr/local/lib/python2.7/site-packages/pip/__init__.py", line 5, in <module>
    import logging
  File "/usr/local/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/usr/local/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (

The likely reason is that the FROM image is python:2, which contains a python built from source. The apt-get invocation however installs python packages from Debian.

mhaas avatar Jan 07 '18 18:01 mhaas

The following patch works for me:

mhaas@ivanov:~/dev/python-firetv$ git diff
diff --git a/Dockerfile b/Dockerfile
index b0b7598..e3fbb78 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,12 @@
-FROM python:2
+FROM buildpack-deps:stretch
 MAINTAINER Jon Bullen
 
 RUN apt-get update && apt-get install -y \
         libssl-dev \
         libusb-1.0-0 \
+        python \
         python-dev \
+        python-pip \
         swig \
         curl \
         unzip \
@@ -17,7 +19,7 @@ RUN apt-get update && apt-get install -y \
 
 RUN pip --no-cache-dir install --upgrade pip
 RUN pip --no-cache-dir install flask
-RUN pip --no-cache-dir install https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.24.0.tar.gz
+RUN pip --no-cache-dir install https://pypi.python.org/packages/01/bd/a41491718f9e2bebab015c42b5be7071c6695acfa301e3fc0480bfd6a15b/M2Crypto-0.27.0.tar.gz
 RUN pip install /tmp/python-firetv-master[firetv-server]
 
 CMD ["firetv-server", "-c", "config/devices.yaml"]

The originally used python:2 image uses FROM buildpack-deps:jessie, so I just decided to use that for this Dockerfile as well. Note that I used stretch instead of jessie, which is why I had to update m2crypto to make it build. If I had used jessie, the originally used version should have worked.

mhaas avatar Jan 08 '18 05:01 mhaas

@mhaas any way you can create a PR with the patch so long as it doesn't break anything else?

Aareon avatar Feb 08 '18 19:02 Aareon

@Aareon I was just working on the PR, but I cannot run current master with the patch above due to commit 5de43fc45c32245facb8d12121c11903bc19b421

Does python-firetv now require python 3?

mhaas@ganymed:~/dev/python-firetv$ docker run python-firetv
Traceback (most recent call last):
  File "/usr/local/bin/firetv-server", line 7, in <module>
    from firetv.__main__ import main
  File "/usr/local/lib/python2.7/dist-packages/firetv/__main__.py", line 36
    def is_valid_host(host: str):
                          ^
SyntaxError: invalid syntax

mhaas avatar Feb 22 '18 06:02 mhaas

odd. What version of Python are you using?

Aareon avatar Feb 22 '18 07:02 Aareon