diff --git a/dodo.py b/dodo.py index 1d5e422..eb31fae 100644 --- a/dodo.py +++ b/dodo.py @@ -30,3 +30,15 @@ def task_copy_translations(): "file_dep": [f"{TRANSLATIONS_FOLDER}/{translation}"], "targets": [f"{build}/translations/{translation}"], } + +def task_copy_requirements(): + """Copy requirements.txt to the builds.""" + for build in BUILDS: + yield { + "name": f"copy requirements.txt to {build}", + "actions": [ + f"cp requirements.txt {build}/requirements.txt", + ], + "file_dep": ["requirements.txt"], + "targets": [f"{build}/requirements.txt"], + } diff --git a/grott-current/Dockerfile b/grott-current/Dockerfile index 8a2e17a..2f19954 100644 --- a/grott-current/Dockerfile +++ b/grott-current/Dockerfile @@ -12,9 +12,7 @@ ENV LANG C.UTF-8 # Install python/pip ENV PYTHONUNBUFFERED=1 -RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python -RUN python3 -m ensurepip -RUN pip3 install --no-cache --upgrade pip setuptools +RUN apk add --update --no-cache python3=3.11.4-r4 && ln -sf python3 /usr/bin/python && python3 -m ensurepip #RUN curl -k https://codeload.github.com/johanmeijer/grott/zip/master --output files.zip && unzip files.zip @@ -22,16 +20,17 @@ RUN pip3 install --no-cache --upgrade pip setuptools # Copy data for add-on COPY script.sh /app/script.sh +RUN chmod a+x script.sh + WORKDIR /app RUN curl -Lk 'https://github.com/johanmeijer/grott/archive/refs/heads/master.zip' --output files.zip && unzip -o files.zip && rm files.zip && mv grott-*/*.py ./ # Move the addon RUN curl -L 'https://raw.githubusercontent.com/egguy/grott/feature/ha-extension/examples/Home%20Assistent/grott_ha.py' -o grott_ha.py +COPY requirements.txt requirements.txt #Install required python packages -RUN pip3 install paho-mqtt requests influxdb influxdb +RUN pip3 install --no-cache-dir -r requirements.txt - -RUN chmod a+x script.sh CMD [ "./script.sh" ] # Build arguments diff --git a/grott-current/requirements.txt b/grott-current/requirements.txt new file mode 100644 index 0000000..a9ee875 --- /dev/null +++ b/grott-current/requirements.txt @@ -0,0 +1,3 @@ +paho-mqtt==1.6.1 +requests==2.31.0 +influxdb==5.3.1 diff --git a/grott/Dockerfile b/grott/Dockerfile index 6e3edc7..3fbb251 100644 --- a/grott/Dockerfile +++ b/grott/Dockerfile @@ -12,9 +12,7 @@ ENV LANG C.UTF-8 # Install python/pip ENV PYTHONUNBUFFERED=1 -RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python -RUN python3 -m ensurepip -RUN pip3 install --no-cache --upgrade pip setuptools +RUN apk add --update --no-cache python3=3.11.4-r4 && ln -sf python3 /usr/bin/python && python3 -m ensurepip #RUN curl -k https://codeload.github.com/johanmeijer/grott/zip/master --output files.zip && unzip files.zip @@ -22,14 +20,15 @@ RUN pip3 install --no-cache --upgrade pip setuptools # Copy data for add-on COPY script.sh /app/script.sh +RUN chmod a+x script.sh + WORKDIR /app RUN curl -Lk 'https://github.com/johanmeijer/grott/archive/refs/heads/master.zip' --output files.zip && unzip -o files.zip && rm files.zip && mv grott-*/*.py ./ # Move the addon RUN mv grott-*/examples/Home\ Assistent/grott_ha.py ./ +COPY requirements.txt requirements.txt #Install required python packages -RUN pip install paho-mqtt requests influxdb influxdb +RUN pip3 install --no-cache-dir -r requirements.txt - -RUN chmod a+x script.sh CMD [ "./script.sh" ] diff --git a/grott/requirements.txt b/grott/requirements.txt new file mode 100644 index 0000000..a9ee875 --- /dev/null +++ b/grott/requirements.txt @@ -0,0 +1,3 @@ +paho-mqtt==1.6.1 +requests==2.31.0 +influxdb==5.3.1 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a9ee875 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +paho-mqtt==1.6.1 +requests==2.31.0 +influxdb==5.3.1