From a721008d94d34f655d8749f9fc8fa9f801950427 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 7 Jan 2023 09:55:30 -0600 Subject: [PATCH] feat(api): add image with pytorch CUDA --- .gitlab-ci.yml | 13 ++++++++++--- ...tainerfile.alpine => Containerfile.cpu.alpine} | 0 ...tainerfile.buster => Containerfile.cpu.buster} | 0 api/Containerfile.cuda.buster | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) rename api/{Containerfile.alpine => Containerfile.cpu.alpine} (100%) rename api/{Containerfile.buster => Containerfile.cpu.buster} (100%) create mode 100644 api/Containerfile.cuda.buster diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bfb8ba41..7033e9fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -104,12 +104,19 @@ build-gui-bundle: # IMAGE_ARCH: alpine # IMAGE_FILE: Containerfile.alpine -package-api-oci-buster: +package-api-oci-cpu-buster: extends: - .package-api-oci variables: - IMAGE_ARCH: buster - IMAGE_FILE: Containerfile.buster + IMAGE_ARCH: cpu-buster + IMAGE_FILE: Containerfile.cpu.buster + +package-api-oci-cuda-buster: + extends: + - .package-api-oci + variables: + IMAGE_ARCH: cuda-buster + IMAGE_FILE: Containerfile.cuda.buster package-gui-oci-nginx-alpine: extends: diff --git a/api/Containerfile.alpine b/api/Containerfile.cpu.alpine similarity index 100% rename from api/Containerfile.alpine rename to api/Containerfile.cpu.alpine diff --git a/api/Containerfile.buster b/api/Containerfile.cpu.buster similarity index 100% rename from api/Containerfile.buster rename to api/Containerfile.cpu.buster diff --git a/api/Containerfile.cuda.buster b/api/Containerfile.cuda.buster new file mode 100644 index 00000000..eb590bae --- /dev/null +++ b/api/Containerfile.cuda.buster @@ -0,0 +1,15 @@ +FROM docker.io/python:3.10-buster + +WORKDIR /onnx-web + +# TODO: set up venv within the container + +RUN pip3 install torch torchvision torchaudio + +COPY requirements.txt /onnx-web/requirements.txt + +RUN pip install -r requirements.txt + +COPY onnx_web/ /onnx-web/onnx_web/ + +ENTRYPOINT [ "flask", "--app=onnx_web.serve", "run", "--host=0.0.0.0" ]