tasmota / docker-tasmota

Docker container with a complete build environment for Tasmota using PlatformIO
77 stars 49 forks source link

fix pip cannot write to /.cache #21

Closed barbudor closed 1 year ago

barbudor commented 1 year ago

When new pip dependencies are added to Tasmota, pip install fails with

WARNING: The directory '/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.

This is due to the image being built with all folders belonging to root while the container is ran with -u $UID:$GID (otherwise the user won't have access to the generated files)

This error is the one that required the addition of RUN pip install zopfli

The fix is to create 2 folders /.cache and /.local and give full access to everyone so pip install can work as expected. Not only the dedicated line for zopfli is no more needed (as it will be dynamically installed during build execution) but it also solve the installation of the new requirement for tasmota_metrics

Also replace the RUN platformio platform update by RUN pio pkg update as recommended by the obsolecence warning.