Skip to content

Commit

Permalink
docker: use virtualenv instead of system python
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Nov 18, 2024
1 parent 5970f45 commit d5a2ba0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
12 changes: 7 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ FROM mlonmcu-ci AS mlonmcu

ADD . /mlonmcu
WORKDIR /mlonmcu
RUN pip3 install --upgrade pip --no-cache-dir
RUN pip3 install -r requirements.txt --no-cache-dir
RUN pip3 install . --no-cache-dir
RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"
RUN . /venv/bin/activate && pip install --upgrade pip --no-cache-dir
RUN . /venv/bin/activate && pip install -r requirements.txt --no-cache-dir
RUN . /venv/bin/activate && pip install . --no-cache-dir

CMD ["mlonmcu"]

Expand All @@ -91,13 +93,13 @@ ENV MLONMCU_HOME=/environment

RUN mlonmcu setup -g

RUN pip3 install -r /environment/requirements_addition.txt --no-cache-dir
RUN . /venv/bin/activate && pip install -r /environment/requirements_addition.txt --no-cache-dir

RUN df -h

RUN df -h

RUN mlonmcu setup -v
RUN . /venv/bin/activate && mlonmcu setup -v

RUN df -h

Expand Down
13 changes: 7 additions & 6 deletions docker/Dockerfile2
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ ARG MLONMCU_TEMPLATE
ADD . /mlonmcu
WORKDIR /mlonmcu
RUN df -h
RUN pip3 install --upgrade pip --no-cache-dir
RUN pip3 install -r requirements.txt --no-cache-dir
RUN pip3 install . --no-cache-dir
ENV PATH="/venv/bin:$PATH"
RUN . /venv/bin/activate && pip install --upgrade pip --no-cache-dir
RUN . /venv/bin/activate && pip install -r requirements.txt --no-cache-dir
RUN . /venv/bin/activate && pip install . --no-cache-dir
RUN df -h

WORKDIR /environment

RUN df -h
RUN mlonmcu init --template ${MLONMCU_TEMPLATE} --non-interactive /environment --clone-models --allow-exists
RUN . /venv/bin/activate && mlonmcu init --template ${MLONMCU_TEMPLATE} --non-interactive /environment --clone-models --allow-exists
ENV MLONMCU_HOME=/environment

RUN mlonmcu setup -g

RUN pip3 install -r /environment/requirements_addition.txt --no-cache-dir
RUN . /venv/bin/activate && pip install -r /environment/requirements_addition.txt --no-cache-dir
RUN df -h

RUN mlonmcu setup -v --rebuild
RUN . /venv/bin/activate && mlonmcu setup -v --rebuild
RUN df -h

CMD ["mlonmcu"]
Expand Down

0 comments on commit d5a2ba0

Please sign in to comment.