From 1af08c659b530778a46a1c710a7ed7b33b81a192 Mon Sep 17 00:00:00 2001 From: Minh Nguyen Date: Thu, 11 Jan 2024 13:05:49 +0700 Subject: [PATCH 1/2] Update Dockerfile reorder Dockerfile build command to improve the docker build cache layer --- Dockerfile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3916b1a..07c8586 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,16 +7,6 @@ LABEL org.opencontainers.image.source https://github.com/serengil/deepface RUN mkdir /app RUN mkdir /app/deepface -# ----------------------------------- -# Copy required files from repo into image -COPY ./deepface /app/deepface -COPY ./api/app.py /app/ -COPY ./api/api.py /app/ -COPY ./api/routes.py /app/ -COPY ./api/service.py /app/ -COPY ./requirements.txt /app/ -COPY ./setup.py /app/ -COPY ./README.md /app/ # ----------------------------------- # switch to application directory @@ -48,6 +38,17 @@ RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted # environment variables ENV PYTHONUNBUFFERED=1 +# ----------------------------------- +# Copy required files from repo into image +COPY ./deepface /app/deepface +COPY ./api/app.py /app/ +COPY ./api/api.py /app/ +COPY ./api/routes.py /app/ +COPY ./api/service.py /app/ +COPY ./requirements.txt /app/ +COPY ./setup.py /app/ +COPY ./README.md /app/ + # ----------------------------------- # run the app (re-configure port if necessary) EXPOSE 5000 From ae4c86b6ee6efb45a9f80f9659e2c92b23abca4c Mon Sep 17 00:00:00 2001 From: Minh Nguyen Date: Thu, 11 Jan 2024 13:14:19 +0700 Subject: [PATCH 2/2] Update Dockerfile --- Dockerfile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 07c8586..911df26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ LABEL org.opencontainers.image.source https://github.com/serengil/deepface RUN mkdir /app RUN mkdir /app/deepface - # ----------------------------------- # switch to application directory WORKDIR /app @@ -17,6 +16,17 @@ WORKDIR /app RUN apt-get update RUN apt-get install ffmpeg libsm6 libxext6 -y +# ----------------------------------- +# Copy required files from repo into image +COPY ./deepface /app/deepface +COPY ./api/app.py /app/ +COPY ./api/api.py /app/ +COPY ./api/routes.py /app/ +COPY ./api/service.py /app/ +COPY ./requirements.txt /app/ +COPY ./setup.py /app/ +COPY ./README.md /app/ + # ----------------------------------- # if you plan to use a GPU, you should install the 'tensorflow-gpu' package # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org tensorflow-gpu @@ -38,17 +48,6 @@ RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted # environment variables ENV PYTHONUNBUFFERED=1 -# ----------------------------------- -# Copy required files from repo into image -COPY ./deepface /app/deepface -COPY ./api/app.py /app/ -COPY ./api/api.py /app/ -COPY ./api/routes.py /app/ -COPY ./api/service.py /app/ -COPY ./requirements.txt /app/ -COPY ./setup.py /app/ -COPY ./README.md /app/ - # ----------------------------------- # run the app (re-configure port if necessary) EXPOSE 5000