Skip to content

Commit

Permalink
Merge pull request serengil#1369 from seavphing/improve-dockerfile
Browse files Browse the repository at this point in the history
improve Dockerfile to use entrypoint in order to get better log when …
  • Loading branch information
serengil authored Oct 17, 2024
2 parents 8b654f8 + 9c5981f commit 81fd5a4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ LABEL org.opencontainers.image.source https://github.com/serengil/deepface
RUN mkdir /app
RUN mkdir /app/deepface



# -----------------------------------
# switch to application directory
WORKDIR /app

# -----------------------------------
# update image os
RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6 -y
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
libsm6 \
libxext6 \
libhdf5-dev \
&& rm -rf /var/lib/apt/lists/*

# -----------------------------------
# Copy required files from repo into image
Expand All @@ -25,6 +32,7 @@ COPY ./requirements_local /app/requirements_local.txt
COPY ./package_info.json /app/
COPY ./setup.py /app/
COPY ./README.md /app/
COPY ./entrypoint.sh /app/deepface/api/src/entrypoint.sh

# -----------------------------------
# if you plan to use a GPU, you should install the 'tensorflow-gpu' package
Expand Down Expand Up @@ -55,4 +63,5 @@ ENV PYTHONUNBUFFERED=1
# run the app (re-configure port if necessary)
WORKDIR /app/deepface/api/src
EXPOSE 5000
CMD ["gunicorn", "--workers=1", "--timeout=3600", "--bind=0.0.0.0:5000", "app:create_app()"]
# CMD ["gunicorn", "--workers=1", "--timeout=3600", "--bind=0.0.0.0:5000", "app:create_app()"]
ENTRYPOINT [ "sh", "entrypoint.sh" ]
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Example content
echo "Starting the application..."
exec "$@"

gunicorn -w 1 -b 0.0.0.0:5000 --timeout 7200 --log-level 'debug' --access-logfile - --access-logformat '%(h)s - - [%(t)s] "%(r)s" %(s)s %(b)s %(L)s' app:create_app
4 changes: 2 additions & 2 deletions requirements_local
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ numpy==1.22.3
pandas==2.0.3
Pillow==9.0.0
opencv-python==4.9.0.80
tensorflow==2.9.0
keras==2.9.0
tensorflow==2.13.1
keras==2.13.1

0 comments on commit 81fd5a4

Please sign in to comment.