forked from fischerjulian/facerecognition-yolo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.slim
39 lines (28 loc) · 1.46 KB
/
Dockerfile.slim
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
37
38
39
FROM python:3.11-slim AS build-env
LABEL maintainer="[email protected]"
LABEL description="Facerecognition using (Darknet) Yolo Weights."
ENV TZ=Europe/Berlin
RUN /bin/ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get upgrade -y && apt-get -y install --no-install-recommends \
autoconf automake build-essential cmake libopencv-dev libtool opencv-data
# see: https://docs.aws.amazon.com/lambda/latest/dg/python-image.html
RUN pip install --upgrade pip
RUN pip install awslambdaric
RUN pip install opencv-python-headless
RUN mkdir /tmp/object_recognition
FROM gcr.io/distroless/python3-debian12:nonroot
ENV TZ=Europe/Berlin
WORKDIR /workdir
COPY --from=build-env /etc/timezone /etc/timezone
COPY --from=build-env /etc/localtime /etc/localtime
COPY --from=build-env /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=build-env /tmp/object_recognition /tmp/object_recognition
COPY yolo_opencv.py /workdir/yolo_opencv.py
COPY yolov3.cfg /workdir/yolov3.cfg
COPY yolov3.txt /workdir/yolov3.txt
COPY yolov3.weights /workdir/yolov3.weights
ENV PYTHONPATH=/usr/local/lib/python3.11/site-packages
# see https://docs.docker.com/reference/dockerfile/#understand-how-cmd-and-entrypoint-interact
ENTRYPOINT ["python", "/workdir/yolo_opencv.py", "--config", "/workdir/yolov3.cfg", "--weights", \
"/workdir/yolov3.weights", "--classes", "/workdir/yolov3.txt", "--image"]
CMD ["/tmp/original-image.jpg"]