Skip to content

Commit

Permalink
feat(build): embed GUI bundle in API containers
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 14, 2023
1 parent efd6d49 commit 6eaf92a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions api/Containerfile.cpu.buster
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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" ]
12 changes: 8 additions & 4 deletions api/Containerfile.cuda.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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" ]
Empty file.

0 comments on commit 6eaf92a

Please sign in to comment.