build: move to poetry

This commit is contained in:
2022-10-19 16:59:15 +02:00
committed by Cyrille Nofficial
parent 3766531936
commit bbc0c3b976
8 changed files with 664 additions and 104 deletions

View File

@ -1,35 +1,37 @@
FROM docker.io/library/python:3.9-slim AS model
RUN python3 -m pip install blobconverter
RUN mkdir -p /models
RUN blobconverter --zoo-name mobile_object_localizer_192x192 --zoo-type depthai --shaves 6 --version 2021.4 --output-dir /models || echo ""
RUN ls /models
#######
FROM docker.io/library/python:3.9-slim
FROM docker.io/library/python:3.9-slim as base
# Configure piwheels repo to use pre-compiled numpy wheels for arm
RUN echo -n "[global]\nextra-index-url=https://www.piwheels.org/simple\n" >> /etc/pip.conf
RUN apt-get update && apt-get install -y libgl1 libglib2.0-0
RUN pip3 install numpy
#################
FROM base as model-builder
RUN python3 -m pip install blobconverter
RUN mkdir -p /models
RUN blobconverter --zoo-name mobile_object_localizer_192x192 --zoo-type depthai --shaves 6 --version 2021.4 --output-dir /models || echo ""
#################
FROM base as builder
RUN apt-get install -y git && \
pip3 install poetry==1.2.0 && \
poetry self add "poetry-dynamic-versioning[plugin]"
ADD . .
RUN poetry build
#################
FROM base
RUN mkdir /models
COPY --from=model-builder /models/mobile_object_localizer_192x192_openvino_2021.4_6shave.blob /models/mobile_object_localizer_192x192_openvino_2021.4_6shave.blob
COPY --from=model /models/mobile_object_localizer_192x192_openvino_2021.4_6shave.blob /models/mobile_object_localizer_192x192_openvino_2021.4_6shave.blob
ADD requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
ADD events events
ADD camera camera
ADD setup.cfg setup.cfg
ADD setup.py setup.py
ENV PYTHON_EGG_CACHE=/tmp/cache
RUN python3 setup.py install
COPY --from=builder dist/*.whl /tmp/
RUN pip3 install /tmp/*whl
WORKDIR /tmp
USER 1234