-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (29 loc) · 1.34 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# downloader stage is used to obtain the model code from provate repo + model weights from Zenodo
FROM ubuntu AS downloader
WORKDIR /work
RUN apt-get update && apt-get install --no-install-recommends -y ca-certificates git wget
# we MUST use multistage build here to avoid storing PAT in image history
ARG GITHUB_USER
ARG GITHUB_PAT
RUN mkdir /app
# copying the YoloV5
RUN git clone --depth=1 https://$GITHUB_USER:[email protected]/LostPetInitiative/study_spring_2022.git
RUN cp -r study_spring_2022/zhirui/yolov5 /app/yolov5
# copying the YoloV5 weights
RUN wget https://zenodo.org/record/6663662/files/yolov5s.pt -O /app/yolov5s.pt
FROM python:3.9-slim AS FINAL
# installing openCV dependencies
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt /requirements.txt
# --extra-index-url https://download.pytorch.org/whl/cpu avoids CUDA installation
RUN python -m pip install --upgrade pip && pip install --extra-index-url https://download.pytorch.org/whl/cpu -r /requirements.txt
COPY --from=downloader /app .
ENV KAFKA_URL=kafka:9092
ENV INPUT_QUEUE=kashtanka_distinct_photos_pet_cards
ENV OUTPUT_QUEUE=kashtanka_calvin_zhirui_yolov5_output
CMD python3 serve.py
COPY code .
FROM FINAL as TESTS
COPY example /app/example
RUN python -m unittest discover -v