From 68780c5f79b00cdc34aef3d3dafaaea1c00d8377 Mon Sep 17 00:00:00 2001 From: Chester Ong Date: Tue, 23 Apr 2024 23:53:32 +0800 Subject: [PATCH 1/3] building feast-dev locally into docker image Signed-off-by: Chester Ong --- Makefile | 5 -- .../feature_servers/multicloud/Dockerfile | 49 +++++++++++++------ .../feature_servers/multicloud/Dockerfile.dev | 19 ------- 3 files changed, 35 insertions(+), 38 deletions(-) delete mode 100644 sdk/python/feast/infra/feature_servers/multicloud/Dockerfile.dev diff --git a/Makefile b/Makefile index aed58ed465b..fa7bd8fabb1 100644 --- a/Makefile +++ b/Makefile @@ -433,11 +433,6 @@ build-feast-operator-docker: # Dev images -build-feature-server-dev: - docker buildx build --build-arg VERSION=dev \ - -t feastdev/feature-server:dev \ - -f sdk/python/feast/infra/feature_servers/multicloud/Dockerfile.dev --load . - build-java-docker-dev: make build-java-no-tests REVISION=dev docker buildx build --build-arg VERSION=dev \ diff --git a/sdk/python/feast/infra/feature_servers/multicloud/Dockerfile b/sdk/python/feast/infra/feature_servers/multicloud/Dockerfile index 8a441479184..e22d4f4dad7 100644 --- a/sdk/python/feast/infra/feature_servers/multicloud/Dockerfile +++ b/sdk/python/feast/infra/feature_servers/multicloud/Dockerfile @@ -1,19 +1,40 @@ -FROM python:3.11 +FROM python:3.11 AS builder -RUN apt update && \ - apt install -y \ - jq \ - python3-dev \ - build-essential +RUN apt-get update && apt-get install -y git -RUN pip install pip --upgrade -RUN pip install "feast[aws,gcp,snowflake,redis,go,mysql,postgres]" +# Allow statements and log messages to immediately appear in the Knative logs +ENV PYTHONUNBUFFERED True +# Copy local code to the container image. +ENV APP_HOME /app +WORKDIR $APP_HOME + +# Copy necessary parts of the Feast codebase +COPY . . + +# Install production dependencies into the virtual environment +RUN python -m venv .venv && . .venv/bin/activate && pip install '.[aws,gcp,snowflake,redis,go,mysql,postgres]' + +FROM python:3.11-slim AS runner + +# Allow statements and log messages to immediately appear in the Knative logs +ENV PYTHONUNBUFFERED True + +# Copy local code to the container image. +ENV APP_HOME /app +WORKDIR $APP_HOME + +# Copy the virtual environment with the production dependencies from the builder stage +COPY --from=builder $APP_HOME/.venv $APP_HOME/.venv +ENV PATH="$APP_HOME/.venv/bin:${PATH}" + +# Add runtime dependencies such as libarrow +RUN apt-get update && \ + apt-get install -y git cmake ca-certificates lsb-release wget && \ + wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb &&\ + apt-get install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb &&\ + apt-get update &&\ + apt-get install -y libarrow-dev &&\ + apt-get clean -RUN apt update -RUN apt install -y -V ca-certificates lsb-release wget -RUN wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb -RUN apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb -RUN apt update -RUN apt -y install libarrow-dev RUN mkdir -m 775 /.cache \ No newline at end of file diff --git a/sdk/python/feast/infra/feature_servers/multicloud/Dockerfile.dev b/sdk/python/feast/infra/feature_servers/multicloud/Dockerfile.dev deleted file mode 100644 index 948e3569a64..00000000000 --- a/sdk/python/feast/infra/feature_servers/multicloud/Dockerfile.dev +++ /dev/null @@ -1,19 +0,0 @@ -FROM python:3.11 - -RUN apt update && \ - apt install -y \ - jq \ - python3-dev \ - build-essential - -RUN pip install pip --upgrade -COPY . . - -RUN pip install "feast[aws,gcp,snowflake,redis,go,mysql,postgres]" - -RUN apt update -RUN apt install -y -V ca-certificates lsb-release wget -RUN wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb -RUN apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb -RUN apt update -RUN apt -y install libarrow-dev \ No newline at end of file From 015da387ffa9bfd5e9e5ebc4edb0fcdd3294b5ae Mon Sep 17 00:00:00 2001 From: Chester Ong Date: Wed, 24 Apr 2024 00:04:22 +0800 Subject: [PATCH 2/3] make build-feature-server-dev can use the base Dockerfile Signed-off-by: Chester Ong --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index fa7bd8fabb1..c361d3093d6 100644 --- a/Makefile +++ b/Makefile @@ -433,6 +433,11 @@ build-feast-operator-docker: # Dev images +build-feature-server-dev: + docker buildx build --build-arg VERSION=dev \ + -t feastdev/feature-server:dev \ + -f sdk/python/feast/infra/feature_servers/multicloud/Dockerfile --load . + build-java-docker-dev: make build-java-no-tests REVISION=dev docker buildx build --build-arg VERSION=dev \ From 4e4e59c7ad2fb7d52572d26d5bfae3726c2f277d Mon Sep 17 00:00:00 2001 From: Chester Ong Date: Thu, 30 May 2024 09:35:12 +0800 Subject: [PATCH 3/3] retest Signed-off-by: Chester Ong