浏览代码

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

Fabian Peter Hammerle 4 年之前
父节点
当前提交
0ec8786d19
共有 2 个文件被更改,包括 16 次插入1 次删除
  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).
 
 ## 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
 ### Added

+ 10 - 1
Dockerfile

@@ -1,6 +1,13 @@
 ARG HOME_ASSISTANT_VERSION=0.104.3
 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:
 # 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 /g+s -exec chmod -c g-s {} \; \
     && 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
 USER hass