From 97bd245dfca680e548f0a8a8a3c0b25fd8d91e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Tue, 28 Feb 2017 18:31:43 +0100 Subject: [PATCH] Changed data directory --- Dockerfile.template | 4 ++-- senpy/plugins/__init__.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index 878d10f..7a471be 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -6,7 +6,7 @@ RUN mkdir /cache/ /senpy-plugins /data/ VOLUME /data/ -ENV PIP_CACHE_DIR=/cache/ +ENV PIP_CACHE_DIR=/cache/ SENPY_DATA=/data ONBUILD COPY . /senpy-plugins/ ONBUILD RUN python -m senpy --only-install -f /senpy-plugins @@ -19,4 +19,4 @@ RUN pip install --use-wheel -r test-requirements.txt -r requirements.txt COPY . /usr/src/app/ RUN pip install --no-deps --no-index . -ENTRYPOINT ["python", "-m", "senpy", "-f", "/senpy-plugins/", "--host", "0.0.0.0"] \ No newline at end of file +ENTRYPOINT ["python", "-m", "senpy", "-f", "/senpy-plugins/", "--host", "0.0.0.0"] diff --git a/senpy/plugins/__init__.py b/senpy/plugins/__init__.py index fdc6882..9f5e889 100644 --- a/senpy/plugins/__init__.py +++ b/senpy/plugins/__init__.py @@ -3,6 +3,7 @@ standard_library.install_aliases() import inspect import os.path +import os import pickle import logging import tempfile @@ -92,8 +93,8 @@ class ShelfMixin(object): @property def shelf_file(self): if 'shelf_file' not in self or not self['shelf_file']: - self.shelf_file = os.path.join(tempfile.gettempdir(), - self.name + '.p') + sd = os.environ.get('SENPY_DATA', tempfile.gettempdir()) + self.shelf_file = os.path.join(sd, self.name + '.p') return self['shelf_file'] def save(self):