From 25eccce8145a4a2a23828b2e21d7593d3b8d063c Mon Sep 17 00:00:00 2001 From: Shahd Yousef <67276189+shahdyousefak@users.noreply.github.com> Date: Mon, 16 Dec 2024 02:28:47 -0500 Subject: [PATCH] S61: Reorganizing files to optimize docker caching layers (#920) * First batch of changes to Dockerfiles. Testing, but want to track changes * combining run commands * second batch of changes. making layers more efficient * avoiding tzdata prompts * testing a way to obtain faster build times * reverting. --- handlers/hello-handler/Dockerfile | 2 +- orchestrator/Dockerfile | 11 +++---- preprocessors/action-recognition/Dockerfile | 13 +++----- preprocessors/autour/Dockerfile | 8 ++--- preprocessors/celebrity-detector/Dockerfile | 6 ++-- preprocessors/clothes-detector/Dockerfile | 33 ++++++++++--------- preprocessors/collage-detector/Dockerfile | 11 +++---- preprocessors/content-categoriser/Dockerfile | 8 ++--- preprocessors/depth-map-gen/Dockerfile | 22 ++++++++----- preprocessors/graphic-caption/Dockerfile | 7 ++-- preprocessors/graphic-tagger/Dockerfile | 9 ++--- preprocessors/grouping/Dockerfile | 8 ++--- preprocessors/hello-preprocessor/Dockerfile | 2 +- preprocessors/line-charts/Dockerfile | 8 ++--- preprocessors/mmsemseg/Dockerfile | 9 +++-- preprocessors/ner/Dockerfile | 22 +++++++------ preprocessors/nominatim/Dockerfile | 3 +- .../object-depth-calculator/Dockerfile | 8 ++--- .../object-detection-azure/Dockerfile | 6 ++-- preprocessors/ocr/Dockerfile | 7 ++-- preprocessors/openstreetmap/Dockerfile | 8 ++--- preprocessors/sorting/Dockerfile | 7 ++-- preprocessors/yolov8/Dockerfile | 16 +++++---- services/espnet-tts/Dockerfile | 12 +++---- 24 files changed, 112 insertions(+), 134 deletions(-) diff --git a/handlers/hello-handler/Dockerfile b/handlers/hello-handler/Dockerfile index 738deb307..8460f4cc1 100644 --- a/handlers/hello-handler/Dockerfile +++ b/handlers/hello-handler/Dockerfile @@ -8,8 +8,8 @@ COPY /handlers/hello-handler/package*.json ./ RUN npm ci COPY /handlers/hello-handler/*.json ./ COPY /handlers/hello-handler/.eslintrc.js ./ -COPY /handlers/hello-handler/src ./src COPY /schemas src/schemas +COPY /handlers/hello-handler/src ./src RUN npm run build ENV NODE_ENV=production diff --git a/orchestrator/Dockerfile b/orchestrator/Dockerfile index e4ba9742e..430d69e0f 100644 --- a/orchestrator/Dockerfile +++ b/orchestrator/Dockerfile @@ -1,25 +1,24 @@ FROM node:alpine as builder - WORKDIR /usr/src/app COPY orchestrator/*.js* ./ RUN npm ci -COPY orchestrator/src ./src + COPY schemas src/schemas +COPY orchestrator/src ./src RUN npm run build && npm prune --production FROM node:alpine as final -RUN apk add memcached +RUN apk add memcached supercronic # Set up for logging WORKDIR /var/log/IMAGE -RUN apk add supercronic + RUN chmod o+wx . WORKDIR /usr/src/app COPY orchestrator/clean-cron ./clean-cron -RUN chown node:node clean-cron -RUN chmod 644 clean-cron +RUN chown node:node clean-cron && chmod 644 clean-cron COPY --from=builder --chown=node:node /usr/src/app/*.js* ./ COPY --from=builder --chown=node:node /usr/src/app/dist ./dist diff --git a/preprocessors/action-recognition/Dockerfile b/preprocessors/action-recognition/Dockerfile index 07b171ff3..7bd950671 100644 --- a/preprocessors/action-recognition/Dockerfile +++ b/preprocessors/action-recognition/Dockerfile @@ -7,11 +7,9 @@ ENV PYTHONUNBUFFERED=TRUE ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ - apt-get install --no-install-recommends -y \ - wget \ - && rm -rf /var/lib/apt/lists/* - -RUN adduser --disabled-password python + apt-get install --no-install-recommends wget -y && \ + rm -rf /var/lib/apt/lists/* && \ + adduser --disabled-password python WORKDIR /app @@ -19,12 +17,11 @@ RUN wget https://image.a11y.mcgill.ca/models/action_recognition/model.pth ENV PATH="/home/python/.local/bin:${PATH}" -RUN pip3 install --no-cache-dir --upgrade pip COPY --chown=python:python /preprocessors/action-recognition/requirements.txt /app/requirements.txt -RUN pip3 install --no-cache-dir -r /app/requirements.txt +RUN pip3 install --no-cache-dir --upgrade pip && \ + pip3 install --no-cache-dir -r /app/requirements.txt COPY --chown=python:python /schemas /app/schemas - COPY --chown=python:python /preprocessors/action-recognition /app EXPOSE 5000 diff --git a/preprocessors/autour/Dockerfile b/preprocessors/autour/Dockerfile index 9a3d50041..dbdb76d4b 100644 --- a/preprocessors/autour/Dockerfile +++ b/preprocessors/autour/Dockerfile @@ -4,15 +4,11 @@ RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" -RUN pip3 install --upgrade pip - COPY /preprocessors/autour/requirements.txt /app/requirements.txt - - -RUN pip3 install -r requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r /app/requirements.txt COPY /schemas /app/schemas - COPY /preprocessors/autour/ /app EXPOSE 5000 diff --git a/preprocessors/celebrity-detector/Dockerfile b/preprocessors/celebrity-detector/Dockerfile index 2d864b4dd..ec7250c1b 100644 --- a/preprocessors/celebrity-detector/Dockerfile +++ b/preprocessors/celebrity-detector/Dockerfile @@ -8,14 +8,12 @@ RUN apt-get update && apt-get install -y python3-opencv wget && rm -rf /var/lib/ COPY /preprocessors/celebrity-detector/requirements.txt /app/requirements.txt -RUN pip3 install --upgrade pip -RUN pip install -r /app/requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r /app/requirements.txt COPY /schemas /app/schemas -WORKDIR /app COPY /preprocessors/celebrity-detector /app - EXPOSE 5000 ENV FLASK_APP=celebrity-detector.py USER python diff --git a/preprocessors/clothes-detector/Dockerfile b/preprocessors/clothes-detector/Dockerfile index da66c6560..eb8ad32fb 100644 --- a/preprocessors/clothes-detector/Dockerfile +++ b/preprocessors/clothes-detector/Dockerfile @@ -1,37 +1,38 @@ FROM pytorch/pytorch:2.4.1-cuda11.8-cudnn9-runtime +ENV DEBIAN_FRONTEND=noninteractive + RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" -#install system dependencies +#install system dependencies in one layer RUN apt-get update && \ - apt-get install -y python3-opencv wget && \ - apt-get install -y build-essential libfreetype6-dev libpng-dev libharfbuzz-dev libcairo2-dev python3-dev && \ + apt-get install -y \ + python3-opencv wget build-essential \ + libfreetype6-dev libpng-dev libharfbuzz-dev \ + libcairo2-dev python3-dev p7zip p7zip-full \ + unace zip unzip && \ + apt-get -y autoremove && \ + apt-get clean && \ rm -rf /var/lib/apt/lists/* COPY /preprocessors/clothes-detector/requirements.txt /app/requirements.txt -# COPY ./requirements.txt /app/requirements.txt - -RUN apt-get update -y && \ - apt-get upgrade -y && \ - apt-get dist-upgrade -y && \ - apt-get -y autoremove && \ - apt-get clean -RUN apt-get install -y p7zip p7zip-full unace zip unzip - RUN pip3 install --upgrade pip && \ pip3 install -r /app/requirements.txt - -RUN wget https://image.a11y.mcgill.ca/models/clothesDetector/yolo.zip && \ - unzip yolo.zip +# COPY ./requirements.txt /app/requirements.txt COPY /schemas /app/schemas # COPY ./schemas /app/schemas + +# good practice to remove the archive +RUN wget https://image.a11y.mcgill.ca/models/clothesDetector/yolo.zip && \ + unzip yolo.zip && \ + rm yolo.zip + COPY /preprocessors/clothes-detector /app # COPY ./ /app - EXPOSE 5000 ENV FLASK_APP=clothes.py USER python diff --git a/preprocessors/collage-detector/Dockerfile b/preprocessors/collage-detector/Dockerfile index 094d7e65c..44c168d49 100644 --- a/preprocessors/collage-detector/Dockerfile +++ b/preprocessors/collage-detector/Dockerfile @@ -1,15 +1,14 @@ FROM python:3 -COPY /preprocessors/collage-detector/requirements.txt /app/requirements.txt - -RUN apt-get update && apt-get install -y python3-opencv wget && rm -rf /var/lib/apt/lists/* - RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" -RUN pip3 install --upgrade pip -RUN pip install -r /app/requirements.txt +RUN apt-get update && apt-get install -y python3-opencv wget && apt-get clean && rm -rf /var/lib/apt/lists/* + +COPY /preprocessors/collage-detector/requirements.txt /app/requirements.txt +RUN pip3 install --upgrade pip && \ + pip install -r /app/requirements.txt COPY /schemas /app/schemas COPY /preprocessors/collage-detector/ /app diff --git a/preprocessors/content-categoriser/Dockerfile b/preprocessors/content-categoriser/Dockerfile index 473002c1d..ffae4dfd2 100644 --- a/preprocessors/content-categoriser/Dockerfile +++ b/preprocessors/content-categoriser/Dockerfile @@ -1,13 +1,13 @@ FROM python:alpine3.20 -COPY /preprocessors/content-categoriser/requirements.txt /app/requirements.txt - RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" -RUN pip3 install --upgrade pip -RUN pip3 install -r /app/requirements.txt +COPY /preprocessors/content-categoriser/requirements.txt /app/requirements.txt + +RUN pip3 install --upgrade pip && \ + pip3 install -r /app/requirements.txt COPY /schemas /app/schemas COPY /preprocessors/content-categoriser/ /app diff --git a/preprocessors/depth-map-gen/Dockerfile b/preprocessors/depth-map-gen/Dockerfile index e9609920f..5bd5a5cb1 100644 --- a/preprocessors/depth-map-gen/Dockerfile +++ b/preprocessors/depth-map-gen/Dockerfile @@ -1,24 +1,30 @@ FROM pytorch/pytorch:1.13.0-cuda11.6-cudnn8-runtime -COPY /preprocessors/depth-map-gen/requirements.txt /app/requirements.txt - +#system dependencies RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python3-opencv wget git && rm -rf /var/lib/apt/lists/* +#user/environment setup RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" ENV PYTHONPATH "${PYTHONPATH}:./AdelaiDepth/LeReS/Minist_Test/" +ENV FLASK_APP=depth-map-generator.py +ENV TORCH_HOME=/app -RUN git clone https://github.com/aim-uofa/AdelaiDepth -RUN wget -O ./res101.pth https://huggingface.co/ffranchina/LeReS/resolve/main/res101.pth -RUN pip3 install --upgrade pip -RUN pip3 install -r /app/requirements.txt +#python dependencies +COPY /preprocessors/depth-map-gen/requirements.txt /app/requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r /app/requirements.txt +#schema COPY /schemas /app/schemas + +#model download, app code +RUN git clone https://github.com/aim-uofa/AdelaiDepth && \ + wget -O ./res101.pth https://huggingface.co/ffranchina/LeReS/resolve/main/res101.pth COPY /preprocessors/depth-map-gen/ /app EXPOSE 5000 -ENV FLASK_APP=depth-map-generator.py -ENV TORCH_HOME=/app + USER python CMD [ "gunicorn", "depth-map-generator:app", "-b", "0.0.0.0:5000", "--capture-output", "--log-level=debug" ] diff --git a/preprocessors/graphic-caption/Dockerfile b/preprocessors/graphic-caption/Dockerfile index 1daf31c7b..99a32d079 100644 --- a/preprocessors/graphic-caption/Dockerfile +++ b/preprocessors/graphic-caption/Dockerfile @@ -1,13 +1,12 @@ FROM python:alpine3.20 -COPY /preprocessors/graphic-caption/requirements.txt /app/requirements.txt - RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" -RUN pip3 install --upgrade pip -RUN pip3 install -r /app/requirements.txt +COPY /preprocessors/graphic-caption/requirements.txt /app/requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r /app/requirements.txt COPY /schemas /app/schemas COPY /preprocessors/graphic-caption/ /app diff --git a/preprocessors/graphic-tagger/Dockerfile b/preprocessors/graphic-tagger/Dockerfile index ab3a066a4..278171468 100644 --- a/preprocessors/graphic-tagger/Dockerfile +++ b/preprocessors/graphic-tagger/Dockerfile @@ -3,18 +3,15 @@ FROM python:3.9-alpine RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" +ENV FLASK_APP=azure_api.py COPY /preprocessors/graphic-tagger/requirements.txt /app/requirements.txt - -RUN pip3 install --upgrade pip -RUN pip install -r /app/requirements.txt +RUN pip3 install --upgrade pip && \ + pip install -r /app/requirements.txt COPY /schemas /app/schemas -WORKDIR /app COPY /preprocessors/graphic-tagger /app - EXPOSE 5000 -ENV FLASK_APP=azure_api.py USER python CMD [ "gunicorn", "azure_api:app", "-b", "0.0.0.0:5000", "--capture-output", "--log-level=debug" ] diff --git a/preprocessors/grouping/Dockerfile b/preprocessors/grouping/Dockerfile index 592124a48..7269f7e2a 100644 --- a/preprocessors/grouping/Dockerfile +++ b/preprocessors/grouping/Dockerfile @@ -2,21 +2,19 @@ FROM python:3.8-alpine RUN apk add --no-cache curl && \ adduser --disabled-password python + WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" -RUN pip3 install --upgrade pip - COPY /preprocessors/grouping/requirements.txt /app/requirements.txt -RUN pip3 install -r requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r /app/requirements.txt COPY /schemas /app/schemas - COPY /preprocessors/grouping/ /app EXPOSE 5000 - ENV FLASK_APP=grouping.py USER python CMD [ "gunicorn", "grouping:app", "-b", "0.0.0.0:5000", "--capture-output", "--log-level=debug" ] diff --git a/preprocessors/hello-preprocessor/Dockerfile b/preprocessors/hello-preprocessor/Dockerfile index 0ec1ab1b0..5b69bdedf 100644 --- a/preprocessors/hello-preprocessor/Dockerfile +++ b/preprocessors/hello-preprocessor/Dockerfile @@ -6,8 +6,8 @@ WORKDIR /usr/src/app # Docker images are onions COPY /preprocessors/hello-preprocessor/package*.json ./ RUN npm ci -COPY /preprocessors/hello-preprocessor/ . COPY /schemas src/schemas +COPY /preprocessors/hello-preprocessor/ . RUN npm run build ENV NODE_ENV=production diff --git a/preprocessors/line-charts/Dockerfile b/preprocessors/line-charts/Dockerfile index 8618bcfbb..0b3622877 100644 --- a/preprocessors/line-charts/Dockerfile +++ b/preprocessors/line-charts/Dockerfile @@ -3,19 +3,17 @@ FROM python:3.10 RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" - -RUN pip3 install --upgrade pip +ENV FLASK_APP=charts.py COPY /preprocessors/line-charts/requirements.txt /app/requirements.txt -RUN pip3 install -r requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r /app/requirements.txt COPY /schemas /app/schemas - COPY /preprocessors/line-charts/ /app EXPOSE 5000 -ENV FLASK_APP=charts.py USER python CMD [ "gunicorn", "charts:app", "-b", "0.0.0.0:5000", "--capture-output", "--log-level=debug" ] diff --git a/preprocessors/mmsemseg/Dockerfile b/preprocessors/mmsemseg/Dockerfile index 62dcb135d..80eb371e9 100644 --- a/preprocessors/mmsemseg/Dockerfile +++ b/preprocessors/mmsemseg/Dockerfile @@ -21,12 +21,11 @@ RUN apt-get update && \ openjdk-11-jre-headless \ wget \ # MMDet Requirements - ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \ - curl && \ + ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 curl && \ rm -rf /var/lib/apt/lists/* ENV PATH="/opt/conda/bin:$PATH" -RUN export FORCE_CUDA=1 +RUN export FORCE_CUDA=1 # MMLAB ARG PYTORCH @@ -39,8 +38,8 @@ RUN adduser --disabled-password python ENV PATH="/home/python/.local/bin:${PATH}" COPY /preprocessors/mmsemseg/requirements.txt /app/requirements.txt -RUN pip install --upgrade pip -RUN pip install -r /app/requirements.txt +RUN pip install --upgrade pip && \ + pip install -r /app/requirements.txt COPY /schemas /app/schemas COPY /preprocessors/mmsemseg/ /app diff --git a/preprocessors/ner/Dockerfile b/preprocessors/ner/Dockerfile index 21d73e49f..29b4f7404 100644 --- a/preprocessors/ner/Dockerfile +++ b/preprocessors/ner/Dockerfile @@ -2,24 +2,26 @@ FROM ubuntu:20.04 ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ -RUN apt-get update -y \ - && apt-get install openjdk-8-jdk -y \ - && apt-get install python3-pip -y \ - && export JAVA_HOME \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + openjdk-8-jdk \ + python3-pip \ + gcc \ + git \ + && apt-get clean && \ + rm -rf /var/lib/apt/lists/* WORKDIR /app RUN adduser --disabled-password python ENV PATH="/home/python/.local/bin:${PATH}" +COPY /preprocessors/ner/requirements.txt /app/requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r /app/requirements.txt + COPY /schemas /app/schemas COPY /preprocessors/ner/ /app -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gcc git && rm -rf /var/lib/apt/lists/* - -RUN pip3 install -r requirements.txt - EXPOSE 5000 ENV FLASK_APP=ner.py diff --git a/preprocessors/nominatim/Dockerfile b/preprocessors/nominatim/Dockerfile index d29772680..ed296ba73 100644 --- a/preprocessors/nominatim/Dockerfile +++ b/preprocessors/nominatim/Dockerfile @@ -1,9 +1,10 @@ FROM node:alpine as builder WORKDIR /usr/src/app -COPY /preprocessors/nominatim/ /usr/src/app +COPY /preprocessors/nominatim/package*.json ./ RUN npm ci COPY /schemas src/schemas +COPY /preprocessors/nominatim/ /usr/src/app RUN npm run build && npm prune --production FROM node:alpine as final diff --git a/preprocessors/object-depth-calculator/Dockerfile b/preprocessors/object-depth-calculator/Dockerfile index 9e08cb923..5bba6d3ef 100644 --- a/preprocessors/object-depth-calculator/Dockerfile +++ b/preprocessors/object-depth-calculator/Dockerfile @@ -1,13 +1,13 @@ FROM python:3.10 -COPY /preprocessors/object-depth-calculator/requirements.txt /app/requirements.txt - RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python3-opencv wget git && rm -rf /var/lib/apt/lists/* RUN adduser --disabled-password python WORKDIR /app -RUN pip3 install --upgrade pip -RUN pip install -r /app/requirements.txt + +COPY /preprocessors/object-depth-calculator/requirements.txt /app/requirements.txt +RUN pip3 install --upgrade pip && \ + pip install -r /app/requirements.txt COPY /schemas /app/schemas COPY /preprocessors/object-depth-calculator/ /app diff --git a/preprocessors/object-detection-azure/Dockerfile b/preprocessors/object-detection-azure/Dockerfile index 6c6f7cdba..e7c97d5e8 100644 --- a/preprocessors/object-detection-azure/Dockerfile +++ b/preprocessors/object-detection-azure/Dockerfile @@ -6,14 +6,12 @@ ENV PATH="/home/python/.local/bin:${PATH}" COPY /preprocessors/object-detection-azure/requirements.txt /app/requirements.txt -RUN pip3 install --upgrade pip -RUN pip install -r /app/requirements.txt +RUN pip3 install --upgrade pip && \ + pip install -r /app/requirements.txt COPY /schemas /app/schemas -WORKDIR /app COPY /preprocessors/object-detection-azure /app - EXPOSE 5000 ENV FLASK_APP=objdetect.py USER python diff --git a/preprocessors/ocr/Dockerfile b/preprocessors/ocr/Dockerfile index b8b1ede4d..c0695ccd6 100644 --- a/preprocessors/ocr/Dockerfile +++ b/preprocessors/ocr/Dockerfile @@ -5,14 +5,11 @@ RUN apk add --no-cache curl && \ WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" -RUN pip3 install --upgrade pip - COPY /preprocessors/ocr/requirements.txt /app/requirements.txt - -RUN pip3 install -r requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r requirements.txt COPY /schemas /app/schemas - COPY /preprocessors/ocr/ /app EXPOSE 5000 diff --git a/preprocessors/openstreetmap/Dockerfile b/preprocessors/openstreetmap/Dockerfile index 20d6740c8..ab6dd15eb 100644 --- a/preprocessors/openstreetmap/Dockerfile +++ b/preprocessors/openstreetmap/Dockerfile @@ -5,15 +5,11 @@ RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" -RUN pip3 install --upgrade pip - COPY ./preprocessors/openstreetmap/requirements.txt /app/requirements.txt - - -RUN pip3 install -r requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r /app/requirements.txt COPY ./schemas /app/schemas - COPY ./preprocessors/openstreetmap/ /app EXPOSE 5000 diff --git a/preprocessors/sorting/Dockerfile b/preprocessors/sorting/Dockerfile index 22399ce4e..fe7fb5574 100644 --- a/preprocessors/sorting/Dockerfile +++ b/preprocessors/sorting/Dockerfile @@ -4,18 +4,15 @@ RUN adduser --disabled-password python WORKDIR /app ENV PATH="/home/python/.local/bin:${PATH}" -RUN pip3 install --upgrade pip - COPY /preprocessors/sorting/requirements.txt /app/requirements.txt -RUN pip3 install -r requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r requirements.txt COPY /schemas /app/schemas - COPY /preprocessors/sorting/ /app EXPOSE 5000 - ENV FLASK_APP=sorting.py USER python CMD [ "gunicorn", "sorting:app", "-b", "0.0.0.0:5000", "--capture-output", "--log-level=debug" ] diff --git a/preprocessors/yolov8/Dockerfile b/preprocessors/yolov8/Dockerfile index 8f54e13b8..b1f40f1bb 100644 --- a/preprocessors/yolov8/Dockerfile +++ b/preprocessors/yolov8/Dockerfile @@ -4,17 +4,19 @@ WORKDIR /usr/src/app RUN adduser --disabled-password python # ENV PATH="/usr/src/app/.local/bin:${PATH}" -RUN pip3 install --upgrade pip RUN apt-get update && \ -DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ -wget \ -&& rm -rf /var/lib/apt/lists/* - -RUN wget https://image.a11y.mcgill.ca/models/objectDetectionWeights/yolov8x.pt + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ + wget && \ + rm -rf /var/lib/apt/lists/* COPY /preprocessors/yolov8/requirements.txt /usr/src/app/requirements.txt -RUN pip3 install -r requirements.txt +RUN pip3 install --upgrade pip && \ + pip3 install -r /usr/src/app/requirements.txt + COPY /schemas /usr/src/app/schemas + +RUN wget https://image.a11y.mcgill.ca/models/objectDetectionWeights/yolov8x.pt + COPY /preprocessors/yolov8 /usr/src/app EXPOSE 5000 diff --git a/services/espnet-tts/Dockerfile b/services/espnet-tts/Dockerfile index 0a60080c1..b052048e4 100644 --- a/services/espnet-tts/Dockerfile +++ b/services/espnet-tts/Dockerfile @@ -1,11 +1,9 @@ FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime -RUN apt-get update && apt-get install -y libsndfile1 build-essential && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y libsndfile1 build-essential wget && rm -rf /var/lib/apt/lists/* WORKDIR /run/tts -RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* -RUN adduser --disabled-password python -RUN chown python:python . +RUN adduser --disabled-password python && chown python:python . USER python ENV PATH="/home/python/.local/bin:${PATH}" @@ -15,9 +13,9 @@ RUN pip install -r requirements.txt COPY /services/espnet-tts/src/predownload.py . RUN python predownload.py -RUN mkdir -p /home/python/.cache/parallel_wavegan/ljspeech_full_band_melgan.v2 -RUN wget https://image.a11y.mcgill.ca/models/espnet/train_nodev_ljspeech_full_band_melgan.v2.tar.gz -O /home/python/.cache/parallel_wavegan/ljspeech_full_band_melgan.v2.tar.gz -RUN tar xzvf /home/python/.cache/parallel_wavegan/ljspeech_full_band_melgan.v2.tar.gz -C /home/python/.cache/parallel_wavegan/ljspeech_full_band_melgan.v2/ +RUN mkdir -p /home/python/.cache/parallel_wavegan/ljspeech_full_band_melgan.v2 && \ + wget https://image.a11y.mcgill.ca/models/espnet/train_nodev_ljspeech_full_band_melgan.v2.tar.gz -O /home/python/.cache/parallel_wavegan/ljspeech_full_band_melgan.v2.tar.gz && \ + tar xzvf /home/python/.cache/parallel_wavegan/ljspeech_full_band_melgan.v2.tar.gz -C /home/python/.cache/parallel_wavegan/ljspeech_full_band_melgan.v2/ COPY /services/espnet-tts/src/* ./ COPY /schemas/services/tts/* ./