Skip to content

Commit 9ba7c90

Browse files
committed
Update Dockerfile for Feast Core
Include exploded/unpacked jar in the production image To be used when staging files when submitting Dataflow jobs
1 parent e89d0d5 commit 9ba7c90

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

infra/docker/core/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
1+
# ============================================================
2+
# Build stage 1: Builder
3+
# ============================================================
4+
15
FROM maven:3.6-jdk-8-slim as builder
26
ARG REVISION=dev
37
COPY . /build
48
WORKDIR /build
9+
#
510
# Setting Maven repository .m2 directory relative to /build folder gives the
611
# user to optionally use cached repository when building the image by copying
712
# the existing .m2 directory to $FEAST_REPO_ROOT/.m2
13+
#
814
ENV MAVEN_OPTS="-Dmaven.repo.local=/build/.m2/repository -DdependencyLocationsEnabled=false"
915
RUN mvn --also-make --projects core,ingestion -Drevision=$REVISION \
1016
-DskipTests=true --batch-mode package
17+
#
18+
# Unpack the jar and copy the files into production Docker image
19+
# for faster startup time when starting Dataflow jobs from Feast Core.
20+
# This is because we need to stage the classes and dependencies when using Dataflow.
21+
# The final size of the production image will be bigger but it seems
22+
# a good tradeoff between speed and size.
23+
#
24+
# https://github.com/gojek/feast/pull/291
25+
RUN apt-get -qq update && apt-get -y install unar && \
26+
unar /build/core/target/feast-core-$REVISION.jar -o /build/core/target/
27+
28+
# ============================================================
29+
# Build stage 2: Production
30+
# ============================================================
1131

1232
FROM openjdk:8-jre as production
1333
ARG REVISION=dev
1434
COPY --from=builder /build/core/target/feast-core-$REVISION.jar /opt/feast/feast-core.jar
35+
COPY --from=builder /build/core/target/feast-core-$REVISION /opt/feast/feast-core
1536
CMD ["java",\
1637
"-Xms2048m",\
1738
"-Xmx2048m",\

infra/docker/serving/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
1+
# ============================================================
2+
# Build stage 1: Builder
3+
# ============================================================
4+
15
FROM maven:3.6-jdk-8-slim as builder
26
ARG REVISION=dev
37
COPY . /build
48
WORKDIR /build
9+
#
510
# Setting Maven repository .m2 directory relative to /build folder gives the
611
# user to optionally use cached repository when building the image by copying
712
# the existing .m2 directory to $FEAST_REPO_ROOT/.m2
13+
#
814
ENV MAVEN_OPTS="-Dmaven.repo.local=/build/.m2/repository -DdependencyLocationsEnabled=false"
915
RUN mvn --also-make --projects serving -Drevision=$REVISION \
1016
-DskipTests=true --batch-mode package
1117

18+
# ============================================================
19+
# Build stage 2: Production
20+
# ============================================================
21+
1222
FROM openjdk:8-jre-alpine as production
1323
ARG REVISION=dev
24+
#
1425
# Download grpc_health_probe to run health check for Feast Serving
1526
# https://kubernetes.io/blog/2018/10/01/health-checking-grpc-servers-on-kubernetes/
27+
#
1628
RUN wget -q https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.3.1/grpc_health_probe-linux-amd64 \
1729
-O /usr/bin/grpc-health-probe && \
1830
chmod +x /usr/bin/grpc-health-probe

0 commit comments

Comments
 (0)