1
0
Fork 0

feat(build): embed GUI bundle in API containers

This commit is contained in:
Sean Sube 2023-01-13 21:56:03 -06:00
parent efd6d49670
commit 6eaf92a748
4 changed files with 24 additions and 8 deletions

View File

@ -83,6 +83,8 @@ build-gui-bundle:
- build-api-coverage
- build-gui-bundle
script:
- mv -v gui/config.json gui/index.html api/gui/
- mv -v gui/bundle/main.js api/gui/bundle/
- cd api
- ${CI_PROJECT_DIR}/common/scripts/image-build.sh --push
variables:
@ -112,6 +114,12 @@ package-api-oci:
IMAGE_FILE: Containerfile.cpu.buster
- IMAGE_ARCH: cuda-ubuntu
IMAGE_FILE: Containerfile.cuda.ubuntu
package-gui-oci:
extends:
- .package-gui-oci
parallel:
matrix:
- IMAGE_ARCH: nginx-alpine
IMAGE_FILE: Containerfile.nginx.alpine
- IMAGE_ARCH: nginx-bullseye

View File

@ -1,12 +1,12 @@
FROM docker.io/python:3.10-buster
WORKDIR /onnx-web
WORKDIR /onnx-web/api
RUN pip3 install virtualenv --upgrade
RUN python3 -m venv onnx_env
ENV PATH="/onnx-web/onnx_web/bin:$PATH"
ENV PATH="/onnx-web/api/onnx_web/bin:$PATH"
RUN pip3 install pip --upgrade
@ -16,6 +16,10 @@ COPY requirements.txt /onnx-web/requirements.txt
RUN pip3 install -r requirements.txt --no-cache-dir
COPY onnx_web/ /onnx-web/onnx_web/
COPY onnx_web/ /onnx-web/api/onnx_web/
ENTRYPOINT [ "flask", "--app=onnx_web.serve", "run", "--host=0.0.0.0" ]
ENV ONNX_WEB_BUNDLE_PATH="/onnx-web/gui"
COPY gui/ /onnx-web/gui/
CMD [ "flask", "--app=onnx_web.serve", "run", "--host=0.0.0.0" ]

View File

@ -4,11 +4,11 @@ RUN apt-get -y update \
&& apt-get -y install python3 python3-pip python3-venv \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /onnx-web
WORKDIR /onnx-web/api
RUN python3 -m venv onnx_env
ENV PATH="/onnx-web/onnx_web/bin:$PATH"
ENV PATH="/onnx-web/api/onnx_web/bin:$PATH"
RUN pip3 install pip --upgrade
@ -20,6 +20,10 @@ RUN pip3 install -r requirements.txt --no-cache-dir
RUN pip3 install onnxruntime-gpu --no-cache-dir
COPY onnx_web/ /onnx-web/onnx_web/
COPY onnx_web/ /onnx-web/api/onnx_web/
ENTRYPOINT [ "flask", "--app=onnx_web.serve", "run", "--host=0.0.0.0" ]
ENV ONNX_WEB_BUNDLE_PATH="/onnx-web/gui"
COPY gui/ /onnx-web/gui/
CMD [ "flask", "--app=onnx_web.serve", "run", "--host=0.0.0.0" ]

View File