From da07a7207643bb68f3c22f4e0a37e4856dab6711 Mon Sep 17 00:00:00 2001 From: Michal Hucko Date: Fri, 28 Jul 2023 14:58:45 +0200 Subject: [PATCH] KF-4011 install necessary libs (#10) * Add mysql necessary libs * Fix rockcraft --- Dockerfile | 9 ++++----- requirements.txt | 4 ++++ rockcraft.yaml | 23 ++++++++--------------- 3 files changed, 16 insertions(+), 20 deletions(-) create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile index 826ec9f..a52a26a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,11 +14,10 @@ RUN set -eux; \ DEBIAN_FRONTEND=noninteractive apt-get remove --purge --auto-remove -y; \ rm -rf /var/lib/apt/lists/*; \ # install mlflow - pip install --no-cache mlflow==$VERSION; \ - # install boto3 - pip install --no-cache boto3; \ - # install prometheus exporter - pip install --no-cache prometheus-flask-exporter + pip install --no-cache mlflow==$VERSION + +COPY requirements.txt requirements.txt +RUN pip install -r requirements.txt --no-cache # to stay consistent with upstream image we separate the dpkg-query to separate layer RUN mkdir -p /usr/share/rocks; \ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6cabc0b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +boto3 +prometheus-flask-exporter +pymysql +cryptography diff --git a/rockcraft.yaml b/rockcraft.yaml index 416a265..2bfcd52 100644 --- a/rockcraft.yaml +++ b/rockcraft.yaml @@ -9,23 +9,26 @@ description: | version: "v2.1.1_22.04_1" license: Apache-2.0 -base: ubuntu:22.04 +build-base: ubuntu:22.04 +base: bare platforms: amd64: +run-user: _daemon_ services: mlflow-server: override: replace command: /usr/bin/python3 startup: enabled - user: ubuntu parts: security-team-requirement: plugin: nil override-build: | mkdir -p ${CRAFT_PART_INSTALL}/usr/share/rocks - (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query + (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && \ + dpkg-query --root=${CRAFT_PROJECT_DIR}/../bundles/ubuntu-22.04/rootfs/ -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) \ + > ${CRAFT_PART_INSTALL}/usr/share/rocks/dpkg.query mlflow: source: . @@ -36,15 +39,5 @@ parts: - tzdata python-packages: - mlflow==2.1.1 - - boto3 - - prometheus-flask-exporter - - non-root-user: - plugin: nil - after: [mlflow] - overlay-script: | - # Create a user in the $CRAFT_OVERLAY chroot - groupadd -R $CRAFT_OVERLAY -g 1001 ubuntu - useradd -R $CRAFT_OVERLAY -M -r -u 1001 -g ubuntu ubuntu - override-prime: | - craftctl default + python-requirements: + - requirements.txt