docker: move venv to runtime

This commit is contained in:
ngxson 2023-08-29 22:58:42 +02:00
parent aea0c74648
commit d844f5ba73

View File

@ -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 \