-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile
66 lines (53 loc) · 1.78 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Erste Stufe: Builder-Image
FROM python:3.8-slim-buster AS builder
# Installieren der notwendigen Systempakete und Build-Tools
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
python3-numpy \
cmake \
gfortran \
libsm6 \
libxext6 \
libxrender-dev \
git \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Erstellen eines virtuellen Python-Umgebungsverzeichnisses
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install Dlib
ENV CFLAGS=-static
RUN pip3 install --upgrade pip && \
git clone -b 'v19.21' --single-branch https://github.com/davisking/dlib.git && \
cd dlib/ && \
python3 setup.py install --set BUILD_SHARED_LIBS=OFF
# Installieren von face_recognition und anderen benötigten Paketen
RUN pip3 install face_recognition opencv-contrib-python-headless flask flask-requests requests psutil pandas
# Zweite Stufe: Runtime-Image
FROM python:3.8-slim-buster AS runtime
# Kopieren der virtuellen Umgebung vom Builder-Image
COPY --from=builder /opt/venv /opt/venv
# Setzen des Pfades für die virtuelle Umgebung
ENV PATH="/opt/venv/bin:$PATH"
# Installieren von Runtime-Abhängigkeiten
RUN apt-get update && apt-get install -y --no-install-recommends \
libsm6 \
libxext6 \
libxrender1 \
supervisor \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Arbeitsverzeichnis festlegen
WORKDIR /FaceStream.ai
# Anwendungskode für beide Server kopieren
COPY app ./app
# Supervisor-Konfigurationsdatei kopieren
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Ports exponieren
EXPOSE 5000
EXPOSE 5001
# Supervisor als Hauptprozess starten
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]