forked from fischerjulian/facerecognition-yolo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.alpine
39 lines (27 loc) · 1.59 KB
/
Dockerfile.alpine
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
FROM python:3.12-alpine3.20 AS build-env
# We're using python:3.12-alpine3.20 so that we can use Alpine's "py3-opencv" binary package (below)
# see: https://pkgs.alpinelinux.org/contents?name=py3-opencv&repo=community&branch=v3.20&arch=x86_64
LABEL maintainer="admin@anynines.com"
LABEL description="Facerecognition using (Darknet) Yolo Weights."
RUN apk add --no-cache --update --repository=https://dl-cdn.alpinelinux.org/alpine/v3.16/main/ libexecinfo-dev
RUN apk add --no-cache --update autoconf automake build-base cmake libcurl libtool make
# see: https://docs.aws.amazon.com/lambda/latest/dg/python-image.html
RUN pip install --upgrade pip
RUN pip install --verbose --no-cache-dir awslambdaric
RUN mkdir /tmp/object_recognition
FROM python:3.12-alpine3.20
RUN apk add --no-cache --update py3-opencv
COPY --from=build-env /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/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
WORKDIR /workdir
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV PYTHONPATH=/usr/lib/python3.12/site-packages
# see https://docs.docker.com/reference/dockerfile/#understand-how-cmd-and-entrypoint-interact
ENTRYPOINT ["/usr/local/bin/python", "/workdir/yolo_opencv.py", "--config", "/workdir/yolov3.cfg", \
"--weights","/workdir/yolov3.weights", "--classes", "/workdir/yolov3.txt", "--image"]
CMD ["/tmp/original-image.jpg"]