Browse Source

docker: fix pipenv failing to create cache

Fabian Peter Hammerle 3 years ago
parent
commit
4b04eb48c6
2 changed files with 6 additions and 2 deletions
  1. 3 0
      CHANGELOG.md
  2. 3 2
      Dockerfile

+ 3 - 0
CHANGELOG.md

@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Added
 - Added command line parameter `--mqtt-password-file`
 
+### Fixed
+- Docker build: fix `pipenv` failing to create cache
+
 ## [0.3.0] - 2020-05-08
 ### Added
 - Publish new state to `homeassistant/switch/switchbot/MAC_ADDRESS/state` on success

+ 3 - 2
Dockerfile

@@ -24,10 +24,11 @@ ARG VIRTUALENV_PATH
 RUN virtualenv --no-site-packages $VIRTUALENV_PATH
 ENV PATH=$VIRTUALENV_PATH/bin:$PATH
 WORKDIR $SOURCE_DIR_PATH
-RUN pip install --no-cache-dir pipenv
+RUN pip install --no-cache-dir pipenv==2020.6.2
 COPY --chown=nobody . $SOURCE_DIR_PATH
+ENV PIPENV_CACHE_DIR=/tmp/pipenv-cache
 RUN pipenv install --deploy --verbose \
-    && rm -r .git/
+    && rm -r .git/ $PIPENV_CACHE_DIR
 
 # workaround for broken multi-stage copy
 # > failed to copy files: failed to copy directory: Error processing tar file(exit status 1): Container ID ... cannot be mapped to a host ID