From 28e5375c399ae5dd146a1b7e13bd5831acb6dc2d Mon Sep 17 00:00:00 2001 From: Felix Falkenberg Date: Wed, 20 Sep 2023 05:25:49 +0200 Subject: [PATCH] Update Dockerfile (GPU Support, Workdir, Permissions) (#1313) --- Dockerfile | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index b8a171f686..badf6e5fda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,21 @@ -FROM python:3.8-slim +# Use the TensorFlow GPU image as the base image. This image also works with CPU-only setups +FROM tensorflow/tensorflow@sha256:b4676741c491bff3d0f29c38c369281792c7d5c5bfa2b1aa93e5231a8d236323 -ENV PYTHONUNBUFFERED 1 -ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV DOCTR_CACHE_DIR=/app/.cache +WORKDIR /app -COPY ./pyproject.toml /tmp/pyproject.toml -COPY ./README.md /tmp/README.md -COPY ./setup.py /tmp/setup.py -COPY ./doctr /tmp/doctr +COPY . . +# Install necessary dependencies for video processing and GUI operations RUN apt-get update \ && apt-get install --no-install-recommends ffmpeg libsm6 libxext6 -y \ - && pip install --upgrade pip setuptools wheel \ - && pip install -e /tmp/.[tf] \ - && pip cache purge \ && apt-get autoremove -y \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /root/.cache/pip + && rm -rf /var/lib/apt/lists/* + +# Install the current application with TensorFlow extras and modify permissions +RUN pip install --upgrade pip setuptools wheel \ + && pip install -e .[tf] \ + && chmod -R a+w /app