diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d10d411 Binary files /dev/null and b/requirements.txt differ diff --git a/src/Dockerfile b/src/Dockerfile index 65f6a97..4bf9180 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -2,18 +2,23 @@ ARG BUILD_FROM FROM $BUILD_FROM RUN apk add --no-cache python3 -RUN apk add --update py3-pip + +WORKDIR /app +COPY requirements.txt . # Copy data for add-on -COPY run.sh / -COPY run.py / -COPY requirements.txt / -COPY main.py / -COPY api.py / -COPY moj_licznik.py / -COPY log_config.py / -COPY database_empty.sqlite /database.sqlite -RUN chmod a+x /run.sh -RUN pip install -r requirements.txt +COPY run.sh . +COPY run.py . +COPY main.py . +COPY api.py . +COPY moj_licznik.py . +COPY log_config.py . +COPY database_empty.sqlite database.sqlite +RUN chmod a+x run.sh -CMD [ "/run.sh" ] \ No newline at end of file +RUN apk add --update --no-cache py3-pip && \ + python3 -m venv /app/venv && \ + source /app/venv/bin/activate && \ + pip install -r requirements.txt + +CMD [ "/app/run.sh" ] diff --git a/src/config.yaml b/src/config.yaml index 19a6062..81542c7 100644 --- a/src/config.yaml +++ b/src/config.yaml @@ -1,6 +1,6 @@ name: "Energa meter" description: "Energa meter addon" -version: "1.0.0" +version: "1.0.1" slug: "energa_meter" init: false options: diff --git a/src/run.sh b/src/run.sh index a85830e..0a9d911 100644 --- a/src/run.sh +++ b/src/run.sh @@ -5,5 +5,6 @@ export PASSWORD=$(bashio::config 'energa_password') export LOG_LEVEL=$(bashio::config 'log_level') bashio::log.info "Uruchamiam API" +source /app/venv/bin/activate python run.py