Przeglądaj źródła

pip: install to user's home dir; added gcc

Fabian Peter Hammerle 4 lat temu
rodzic
commit
0ec8786d19
2 zmienionych plików z 16 dodań i 1 usunięć
  1. 6 0
      CHANGELOG.md
  2. 10 1
      Dockerfile

+ 6 - 0
CHANGELOG.md

@@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 
 ## Unreleased
 ## Unreleased
+### Fixed
+- configure `pip` to install to user's home dir
+  (fixes `EnvironmentError: [Errno 13] Permission denied …` on `pip install`)
+- added `gcc` to be able install python packages
+  that are only available as sdist
+  (e.g., Adafruit-DHT)
 
 
 ## 1.0.0 - 2020-02-01
 ## 1.0.0 - 2020-02-01
 ### Added
 ### Added

+ 10 - 1
Dockerfile

@@ -1,6 +1,13 @@
 ARG HOME_ASSISTANT_VERSION=0.104.3
 ARG HOME_ASSISTANT_VERSION=0.104.3
 FROM homeassistant/home-assistant:$HOME_ASSISTANT_VERSION
 FROM homeassistant/home-assistant:$HOME_ASSISTANT_VERSION
 
 
+# Adafruit-DHT: no wheel available
+# https://pypi.org/project/Adafruit-DHT/1.4.0/#files
+# https://wheels.home-assistant.io/alpine-3.10/armv7/
+RUN apk add --no-cache \
+    gcc \
+    musl-dev
+
 # inherited:
 # inherited:
 # CMD ["python3", "-m", "homeassistant", "--config", "/config"]
 # CMD ["python3", "-m", "homeassistant", "--config", "/config"]
 
 
@@ -12,6 +19,8 @@ RUN python3 -c 'import os; assert os.geteuid() == 0, "finally..."' \
     && find / -xdev -type f -perm /u+s -exec chmod -c u-s {} \; \
     && find / -xdev -type f -perm /u+s -exec chmod -c u-s {} \; \
     && find / -xdev -type f -perm /g+s -exec chmod -c g-s {} \; \
     && find / -xdev -type f -perm /g+s -exec chmod -c g-s {} \; \
     && adduser -D hass \
     && adduser -D hass \
-    && chown hass /config
+    && chown hass /config \
+    && mkdir -p ~hass/.config/pip \
+    && echo -e '[install]\nuser = yes' > ~hass/.config/pip/pip.conf
 VOLUME /config
 VOLUME /config
 USER hass
 USER hass