forked from SeldonIO/seldon-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build adserver dockerimage using poetry-defined environment (SeldonIO…
…#3783) * build adserver dockerimage using poetry-defined environment * add unti test to pipeline * fix typo * fix linter * tests fix? * add tenacity * add stuff for cv imports in test image * . * run only adserver tests * fix image in feedback/metrics-server notebook * fix release.py
- Loading branch information
1 parent
cca88d4
commit 0fd9149
Showing
16 changed files
with
3,978 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: AlibDetect Tests | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-18.04 | ||
container: seldonio/python-builder:0.6 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip setuptools | ||
make -C components/alibi-detect-server dev_install | ||
- name: Lint | ||
run: | | ||
make -C components/alibi-detect-server lint | ||
python-tests: | ||
runs-on: ubuntu-18.04 | ||
container: seldonio/python-builder:0.6 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip setuptools | ||
apt-get -y install ffmpeg libsm6 libxext6 | ||
make -C components/alibi-detect-server dev_install | ||
- name: Test | ||
run: | | ||
make -C components/alibi-detect-server test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ adserver.egg-info | |
.mypy_cache | ||
.pytest_cache | ||
.coverage | ||
_seldon_core | ||
version.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,72 @@ | ||
# TODO: Add to release script | ||
FROM docker.io/seldonio/seldon-core-s2i-python37-ubi8:1.12.0-dev | ||
ARG VERSION | ||
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE}:${VERSION} as base | ||
|
||
ARG VERSION | ||
LABEL name="Seldon Alibi Detect Server" \ | ||
vendor="Seldon Technologies" \ | ||
version="1.12.0-dev" \ | ||
release="1" \ | ||
summary="Alibi Detect Server for Seldon Core" \ | ||
description="The Alibi Detect Server provides outlier, drift and adversarial detection services for Seldon Core" | ||
|
||
FROM base as builder | ||
ARG PYTHON_VERSION | ||
ARG CONDA_VERSION | ||
|
||
# Install Rclone Binary to be present in the image | ||
RUN yum install -y unzip | ||
RUN wget https://downloads.rclone.org/v1.55.1/rclone-v1.55.1-linux-amd64.zip && \ | ||
unzip rclone-v1.55.1-linux-amd64.zip && \ | ||
mv rclone-v1.55.1-linux-amd64/rclone /usr/bin/rclone && \ | ||
rm -rf rclone-v1.55.1-linux-amd64.zip rclone-v1.55.1-linux-amd64 | ||
|
||
ADD requirements_server.txt . | ||
|
||
RUN pip install pip -U | ||
# Install Python / Conda | ||
RUN conda install --yes python=${PYTHON_VERSION} conda=${CONDA_VERSION} | ||
RUN pip install pip==21.2.4 setuptools==58.1.0 | ||
RUN dnf install -y make automake gcc gcc-c++ | ||
|
||
RUN pip install -r requirements_server.txt | ||
# Make home dir | ||
RUN mkdir microservice | ||
WORKDIR /microservice | ||
|
||
# Fix cloudevents bug: https://github.com/cloudevents/sdk-python/issues/24 | ||
RUN git clone --branch 24-extensions https://github.com/ryandawsonuk/sdk-python.git && \ | ||
cd sdk-python && \ | ||
pip install -e . | ||
# Install Poetry | ||
ENV POETRY_HOME /microservice/.poetry | ||
RUN curl -sSL \ | ||
https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py \ | ||
| python3 | ||
|
||
COPY adserver adserver | ||
COPY setup.py . | ||
ENV PATH "$POETRY_HOME/bin:$PATH" | ||
ENV POETRY_VIRTUALENVS_CREATE false | ||
|
||
RUN pip install -e . | ||
# Install the server | ||
COPY poetry.lock pyproject.toml ./ | ||
COPY _seldon_core ./_seldon_core | ||
RUN poetry install && rm ~/.cache/pip -rf | ||
|
||
# Add licences | ||
RUN pip install pip-licenses | ||
RUN mkdir /licenses | ||
RUN mkdir ./licenses && pip-licenses --from=mixed --format=csv --output-file=./licenses/license_info.csv && \ | ||
pip-licenses --from=mixed --format=plain-vertical --with-license-file --no-license-path --output-file=./licenses/license.txt | ||
RUN cp ./licenses/* /licenses | ||
|
||
# Copy rest of the package | ||
COPY adserver adserver | ||
COPY README.md README.md | ||
COPY version.txt version.txt | ||
|
||
FROM base as final | ||
WORKDIR /microservice | ||
|
||
# this is to avoid "ImportError: libGL.so.1" from opencv | ||
RUN yum install -y mesa-libGL | ||
RUN mv ./licenses /licenses | ||
RUN yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical | ||
# CVE https://github.com/SeldonIO/seldon-core/issues/2960 | ||
RUN yum remove -y nodejs httpd | ||
|
||
COPY --from=builder /microservice /microservice | ||
COPY --from=builder /opt/conda /opt/conda | ||
COPY --from=builder /licenses /licenses | ||
|
||
ENTRYPOINT ["python", "-m", "adserver"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.