From ce3c4aec4b11695641b3d236536770f6077490ed Mon Sep 17 00:00:00 2001 From: Brandon Davis Date: Thu, 4 Nov 2021 10:52:36 -0400 Subject: [PATCH 1/2] Fix ffmpeg install --- docker/girder_worker.Dockerfile | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/docker/girder_worker.Dockerfile b/docker/girder_worker.Dockerfile index f6e5e8da7..2f1d9feed 100644 --- a/docker/girder_worker.Dockerfile +++ b/docker/girder_worker.Dockerfile @@ -9,27 +9,32 @@ RUN chmod +x /tini # VIAME pipelines at /opt/noaa/viame/configs/pipelines/ # BEGIN: Porting girder worker install from girder/girder_worker Dockerfile.py3 -RUN apt-get update && \ - apt-get install -qy software-properties-common && \ - add-apt-repository ppa:savoury1/ffmpeg4 && \ +RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get update && \ - export DEBIAN_FRONTEND=noninteractive && \ - apt-get install -qy software-properties-common python3-software-properties && \ - apt-get update && apt-get install -qy \ + apt-get install -qy \ build-essential \ wget \ python3.7 \ - r-base \ + libpython3.7-dev \ libffi-dev \ libssl-dev \ libjpeg-dev \ - zlib1g-dev \ - r-base \ - ffmpeg \ - libpython3.7-dev && \ + zlib1g-dev && \ apt-get clean && rm -rf /var/lib/apt/lists/* -RUN wget https://bootstrap.pypa.io/get-pip.py && python3.7 get-pip.py +# Install ffmpeg 4.4 from https://www.johnvansickle.com/ffmpeg/ +RUN \ + wget -O ffmpeg.tar.xz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \ + mkdir ffextracted && \ + tar -xvf ffmpeg.tar.xz -C ffextracted --strip-components 1 && \ + mv ffextracted/ffmpeg ffextracted/ffprobe /usr/local/bin/ && \ + rm -rf ffmpeg.tar.xz ffextracted + +# Install pip +RUN \ + wget https://bootstrap.pypa.io/get-pip.py && \ + python3.7 get-pip.py && \ + rm get-pip.py # END port of worker installation # Switch over to user "worker" 1099:1099 to align with base image From 3457bcf2a671c296fcf915a285a080d2d1cf2b7b Mon Sep 17 00:00:00 2001 From: Brandon Davis Date: Thu, 4 Nov 2021 13:30:18 -0400 Subject: [PATCH 2/2] Bring back virtual environment, install in /opt/venv same as server --- docker/girder_worker.Dockerfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/docker/girder_worker.Dockerfile b/docker/girder_worker.Dockerfile index 2f1d9feed..0246e81f4 100644 --- a/docker/girder_worker.Dockerfile +++ b/docker/girder_worker.Dockerfile @@ -15,6 +15,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ build-essential \ wget \ python3.7 \ + python3.7-venv \ libpython3.7-dev \ libffi-dev \ libssl-dev \ @@ -37,18 +38,28 @@ RUN \ rm get-pip.py # END port of worker installation -# Switch over to user "worker" 1099:1099 to align with base image +# Create user "dive" 1099:1099 to align with base image permissions. # https://github.com/VIAME/VIAME/blob/master/cmake/build_server_docker.sh#L123 RUN useradd --create-home --uid 1099 --shell=/bin/bash dive + +# Create a virtualenv dir outside the home directory so it's preserved +# when code is mounted in dev mode. +RUN install -g dive -o dive -d /opt/venv + +# Switch to the new user and working directory USER dive WORKDIR /home/dive +# Initialize python virtual environment +ENV VIRTUAL_ENV=/opt/venv +RUN python3.7 -m venv $VIRTUAL_ENV + +# Activate the virtual environment by linking it on PATH +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + # Create directory for addons RUN mkdir -p /tmp/addons -# Add dive user's local bin to PATH -ENV PATH="/home/dive/.local/bin:$PATH" - # Cryptography requires latest pip, setuptools. # https://cryptography.io/en/latest/faq.html#installing-cryptography-fails-with-error-can-not-find-rust-compiler RUN pip install -U pip setuptools