diff --git a/Dockerfile b/Dockerfile index 7ee219f..da68e3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,22 +3,27 @@ ARG DEBIAN_FRONTEND=noninteractive FROM debian:bullseye-slim AS builder ARG PYTHON_DEP -RUN BUILD_DEP='python3-pip python3-setuptools python3-dev libblas-dev liblapack-dev gfortran libatlas3-base' ; \ +RUN BUILD_DEP='python3-pip python3-setuptools python3-dev libblas-dev liblapack-dev gfortran' ; \ apt-get update && apt-get install -y --no-install-recommends $BUILD_DEP $PYTHON_DEP; -COPY psa-car-controller /psa-car-controller -COPY requirements.txt /tmp/ -RUN pip3 install --system --no-cache-dir --ignore-installed -r /tmp/requirements.txt +RUN pip3 install --upgrade pip +RUN pip3 install poetry +COPY poetry.lock pyproject.toml ./ +RUN poetry export -f requirements.txt --output /tmp/requirements.txt +RUN pip3 install --no-deps --no-cache-dir --ignore-installed -r /tmp/requirements.txt +RUN poetry install EXPOSE 5000 FROM debian:bullseye-slim ARG PYTHON_DEP WORKDIR /config -ENV PSACC_BASE_PATH=/ PSACC_PORT=5000 PSACC_OPTIONS="-c -r --web-conf" PSACC_CONFIG_DIR="/config" +ENV PSACC_BASE_PATH=/ PSACC_PORT=5000 PSACC_OPTIONS="-c -r --web-conf" PSACC_CONFIG_DIR="/config" PYTHONPATH="/app" COPY --from=builder /var/lib/apt /var/lib/apt COPY --from=builder /var/cache/apt/ /var/cache/apt/ COPY --from=builder /usr/local/lib /usr/local/lib RUN apt-get install -y --no-install-recommends $PYTHON_DEP && \ apt-get clean ; \ rm -rf /var/lib/apt/lists/* -COPY . /psa-car-controller/ -CMD /psa-car-controller/docker_files/init.sh \ No newline at end of file +RUN mkdir app +COPY psa_car_controller /app/psa_car_controller +COPY /docker_files/init.sh /init.sh +CMD /init.sh \ No newline at end of file diff --git a/docker_files/init.sh b/docker_files/init.sh index a26c780..8e577a5 100755 --- a/docker_files/init.sh +++ b/docker_files/init.sh @@ -2,4 +2,4 @@ echo "Containerised psa_car_controller loading..." cd "$PSACC_CONFIG_DIR" ARGS="-p $PSACC_PORT -l 0.0.0.0 -b $PSACC_BASE_PATH $PSACC_OPTIONS" -python3 -u /psa_car_controller $ARGS +python3 -u -m psa_car_controller $ARGS diff --git a/docs/Install.md b/docs/Install.md index 86e9dd6..1a5a1f0 100644 --- a/docs/Install.md +++ b/docs/Install.md @@ -4,7 +4,7 @@ 1.2 Install requirements : -- You need **python >= 3.6** +- You need **python >= 3.7** - On debian based distribution you can install some requirement from repos, it's faster than installtion with pip: @@ -20,10 +20,10 @@ Start the app with charge control enabled : -``python3 psa-car-controller --web-conf`` +``python3 -m psa-car-controller --web-conf`` At the first launch you will be asked to connect and give a code that you will receive by SMS and also give your pin code (the four-digit code that your use on the android app). If it failed you can remove the file otp.bin and retry. You can see all options available with : -``python3 psa-car-controller -h`` +``python3 -m psa-car-controller -h``