From d844f5ba7362c7204bd1f6fcfa58d599b930cfaf Mon Sep 17 00:00:00 2001 From: ngxson Date: Tue, 29 Aug 2023 22:58:42 +0200 Subject: [PATCH] docker: move venv to runtime --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0f8c5a4c..ebf1d93f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,6 @@ FROM python:3.10 WORKDIR /srv COPY ./requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt - COPY ./app.py /srv/app.py COPY ./api /srv/api COPY ./static /srv/static @@ -17,8 +15,12 @@ COPY ./.git /srv/.git VOLUME [ "/data" ] -# Monkey-patch: send a "enter" keystroke to python to confirm the first launch process +# Monkey-patch (1): because "binding_zoo" install the packets inside venv, we cannot do pip install on build time +# Monkey-patch (2): send a "enter" keystroke to python to confirm the first launch process CMD ["/bin/bash", "-c", " \ + python -m venv /data/venv; \ + source /data/venv/bin/activate; \ + python -m pip install --no-cache-dir -r requirements.txt --upgrade pip; \ echo -ne '\n' | \ python app.py \ --host 0.0.0.0 \