From 77d68bf6ac7fe27b2357da90d4fd0356fa3dc8b9 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 21 Jan 2023 14:43:36 -0600 Subject: [PATCH] fix(build): add cv2 deps to CPU image --- api/Containerfile.cpu.buster | 6 ++++++ api/gui/.gitignore | 3 +++ run/cpu/docker-compose.yaml | 24 ++++++++++++++++++++++++ {common => run/cpu}/pod-cpu.yaml | 0 {common => run/cuda}/pod-cuda.yaml | 0 5 files changed, 33 insertions(+) create mode 100644 api/gui/.gitignore create mode 100644 run/cpu/docker-compose.yaml rename {common => run/cpu}/pod-cpu.yaml (100%) rename {common => run/cuda}/pod-cuda.yaml (100%) diff --git a/api/Containerfile.cpu.buster b/api/Containerfile.cpu.buster index 31fb707d..b38dbbe9 100644 --- a/api/Containerfile.cpu.buster +++ b/api/Containerfile.cpu.buster @@ -2,6 +2,10 @@ FROM docker.io/python:3.10-buster WORKDIR /onnx-web/api +RUN apt-get -y update \ + && apt-get install -y ffmpeg libsm6 libxext6 \ + && rm -rf /var/lib/apt/lists/* + RUN pip3 install virtualenv --upgrade RUN python3 -m venv onnx_env @@ -18,6 +22,8 @@ RUN pip3 install -r requirements.txt --no-cache-dir COPY onnx_web/ /onnx-web/api/onnx_web/ +COPY params.json /onnx-web/api/params.json + ENV ONNX_WEB_BUNDLE_PATH="/onnx-web/gui" COPY gui/ /onnx-web/gui/ diff --git a/api/gui/.gitignore b/api/gui/.gitignore new file mode 100644 index 00000000..e9b37fd2 --- /dev/null +++ b/api/gui/.gitignore @@ -0,0 +1,3 @@ +bundle/main.js +config.json +index.html diff --git a/run/cpu/docker-compose.yaml b/run/cpu/docker-compose.yaml new file mode 100644 index 00000000..77fd7383 --- /dev/null +++ b/run/cpu/docker-compose.yaml @@ -0,0 +1,24 @@ +services: + onnx-web-api: + image: docker.io/ssube/onnx-web-api:main-cpu-buster + command: sh -c "python -m onnx_web.convert --diffusion --upscaling --correction && flask --app=onnx_web.serve run --host=0.0.0.0" + environment: + - ONNX_WEB_MODEL_PATH=/data/models + - ONNX_WEB_OUTPUT_PATH=/data/outputs + ports: + - "5000:5000" + volumes: + - type: volume + source: onnx-web-models + target: /data/models + volume: + nocopy: true + - type: volume + source: onnx-web-outputs + target: /data/outputs + volume: + nocopy: true + +volumes: + onnx-web-models: {} + onnx-web-outputs: {} diff --git a/common/pod-cpu.yaml b/run/cpu/pod-cpu.yaml similarity index 100% rename from common/pod-cpu.yaml rename to run/cpu/pod-cpu.yaml diff --git a/common/pod-cuda.yaml b/run/cuda/pod-cuda.yaml similarity index 100% rename from common/pod-cuda.yaml rename to run/cuda/pod-cuda.yaml