pannal / Kitana

A responsive Plex plugin web frontend
Other
496 stars 25 forks source link

Missing "gcc" when building image on armhf #10

Closed raph521 closed 5 years ago

raph521 commented 5 years ago

Hi,

I encountered an issue when attempting to build an image myself through docker compose. I'm building the image myself as my architecture is armhf.

During the build, I encounter the following error:

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./libsass/include -I/usr/local/include/python3.5m -c libsass/src/ast.cpp -o build/temp.linux-armv7l-3.5/libsass/src/ast.o -fPIC -std=gnu++0x -Wall -Wno-parentheses -Werror=switch -DLIBSASS_VERSION="3.5.4"
  unable to execute 'gcc': No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for libsass

I believe that the issue is that the Dockerfile specifies a base image of python:3.5-slim, but gcc is not available in that image. I noticed this mentioned here:

https://github.com/docker-library/python/issues/60

Should gcc be added to the prereq's file, or maybe the base image changed?

Here's my docker-compose yaml, if it helps:

    kitana:
        container_name: kitana
        build:
            context: https://github.com/pannal/Kitana.git
        restart: unless-stopped
        volumes:
            - /media/storage/config/kitana:/app/data
        environment:
            - TZ=America/New_York
            - PUID=1000
            - PGID=1000
        ports:
            - 31337:31337
raph521 commented 5 years ago

FWIW, I managed to get this sorted by installing the gcc and g++ packages. I created a custom Dockerfile for armhf that does just that:

https://github.com/Raph521/Kitana/blob/master/Dockerfile.armhf

# Use an official Python runtime as a parent image
FROM python:3.5-slim

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
RUN apt-get update \
    && apt-get install -y apt-utils gcc g++ \
    && pip install --trusted-host pypi.python.org -r requirements.txt

# Make port 80 available to the world outside this container
EXPOSE 31337

# Define environment variable
#ENV NAME World

VOLUME /app/data

# Run app.py when the container launches
ENTRYPOINT ["python", "kitana.py"]
pannal commented 5 years ago

Interesting. Care to create a pull request so I can merge that Dockerfile?

raph521 commented 5 years ago

Would be happy to... but it turns out that didn't get Kitana completely working for me on ARM.

I was able to build it and start the container, but when I visit the webpage on 31337, I'm greeted with the following:

500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/zc/lockfile/__init__.py", line 81, in __init__
    fp = open(path, 'r+')
FileNotFoundError: [Errno 2] No such file or directory: '/app/data/sessions/session-80cb366212ddbd7d5dfe6910fb4e8264b2d88c53.lock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/cherrypy/_cprequest.py", line 628, in respond
    self._do_respond(path_info)
  File "/usr/local/lib/python3.5/site-packages/cherrypy/_cprequest.py", line 678, in _do_respond
    self.hooks.run('before_request_body')
  File "/usr/local/lib/python3.5/site-packages/cherrypy/_cprequest.py", line 114, in run
    raise exc
  File "/usr/local/lib/python3.5/site-packages/cherrypy/_cprequest.py", line 104, in run
    hook()
  File "/usr/local/lib/python3.5/site-packages/cherrypy/_cprequest.py", line 63, in __call__
    return self.callback(**self.kwargs)
  File "/usr/local/lib/python3.5/site-packages/cherrypy/_cptools.py", line 280, in _lock_session
    cherrypy.serving.session.acquire_lock()
  File "/usr/local/lib/python3.5/site-packages/cherrypy/lib/sessions.py", line 557, in acquire_lock
    self.lock = zc.lockfile.LockFile(path)
  File "/usr/local/lib/python3.5/site-packages/zc/lockfile/__init__.py", line 117, in __init__
    super(LockFile, self).__init__(path)
  File "/usr/local/lib/python3.5/site-packages/zc/lockfile/__init__.py", line 87, in __init__
    fp = open(path, 'a+')
FileNotFoundError: [Errno 2] No such file or directory: '/app/data/sessions/session-80cb366212ddbd7d5dfe6910fb4e8264b2d88c53.lock'

I'm launching the container via docker-compose with the following:

    kitana:
        container_name: kitana
        build:
            context: https://github.com/Raph521/Kitana.git
            dockerfile: Dockerfile.armhf
        restart: unless-stopped
        volumes:
            - /media/storage/config/kitana:/app/data
        environment:
            - TZ=America/New_York
        ports:
            - 31337:31337
pannal commented 5 years ago

Hmm, that one again. Can you mkdir /app/data/sessions?

raph521 commented 5 years ago

Yeah, I eventually figured out that was the problem :-)

I tried to come up with a platform agnostic way to create the directory on startup if it already doesn't exist. Still need to test it - takes a bit of time to build the image on a Raspberry Pi...

https://github.com/Raph521/Kitana/commit/afe54c243d408baefbb4df5e4cb4841d1a498eb1

pannal commented 5 years ago

Haha, I just pushed a quick fix for that, the minute you wrote :D

raph521 commented 5 years ago

Haha, okay then, thanks!

I'll create a pull request just for the Dockerfile.armhf!

pannal commented 5 years ago

Hmm your makedirs solution is better, though. I'll incorporate that.

raph521 commented 5 years ago

Okay, pull request created:

https://github.com/pannal/Kitana/pull/11

pannal commented 5 years ago

Great, thank you!

raph521 commented 5 years ago

Thanks for the help and for all your work on this project!

pannal commented 5 years ago

My pleasure :)