diff --git a/Makefile b/Makefile index aed58ed465..c361d3093d 100644 --- a/Makefile +++ b/Makefile @@ -436,7 +436,7 @@ build-feast-operator-docker: 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 . + -f sdk/python/feast/infra/feature_servers/multicloud/Dockerfile --load . build-java-docker-dev: make build-java-no-tests REVISION=dev diff --git a/sdk/python/feast/infra/feature_servers/multicloud/Dockerfile b/sdk/python/feast/infra/feature_servers/multicloud/Dockerfile index 8a44147918..e22d4f4dad 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 948e3569a6..0000000000 --- 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