mirror of https://github.com/google/oss-fuzz.git
Build in stages to shed 9gb from the jvm base builder image (#12649)
This PR reduces the final `base-builder-jvm` image by 9GB. Careful review and full integration testing across oss-fuzz projects are required before merging, obviously. This worked on two projects I was interested in. One that used `@FuzzTest` and one that used `fuzzerTestOneInput`
This commit is contained in:
parent
1de481ba18
commit
d6f73fbd2a
|
@ -14,7 +14,7 @@
|
||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
FROM gcr.io/oss-fuzz-base/base-builder
|
FROM gcr.io/oss-fuzz-base/base-builder AS base
|
||||||
|
|
||||||
ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
|
ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
|
||||||
ENV JAVA_15_HOME /usr/lib/jvm/java-15-openjdk-amd64
|
ENV JAVA_15_HOME /usr/lib/jvm/java-15-openjdk-amd64
|
||||||
|
@ -27,6 +27,7 @@ RUN install_java.sh
|
||||||
|
|
||||||
RUN chmod 777 /usr/local/bin && chmod 777 /usr/local/lib
|
RUN chmod 777 /usr/local/bin && chmod 777 /usr/local/lib
|
||||||
|
|
||||||
|
FROM base AS builder
|
||||||
RUN useradd -m jazzer_user
|
RUN useradd -m jazzer_user
|
||||||
|
|
||||||
USER jazzer_user
|
USER jazzer_user
|
||||||
|
@ -54,10 +55,12 @@ RUN cp $(bazel cquery --output=files //src/main/java/com/code_intelligence/jazze
|
||||||
cp $(bazel cquery --output=files //deploy:jazzer-api) $JAZZER_API_PATH && \
|
cp $(bazel cquery --output=files //deploy:jazzer-api) $JAZZER_API_PATH && \
|
||||||
cp $(bazel cquery --output=files //deploy:jazzer-junit) $JAZZER_JUNIT_PATH
|
cp $(bazel cquery --output=files //deploy:jazzer-junit) $JAZZER_JUNIT_PATH
|
||||||
|
|
||||||
USER root
|
FROM base AS final
|
||||||
|
|
||||||
RUN rm -rf /home/jazzer_user/.cache/bazel /home/jazzer_user/.cache/bazelisk && \
|
COPY --from=builder /usr/local/bin/jazzer_agent_deploy.jar /usr/local/bin/jazzer_agent_deploy.jar
|
||||||
rm -rf $SRC/jazzer
|
COPY --from=builder /usr/local/bin/jazzer_driver /usr/local/bin/jazzer_driver
|
||||||
|
COPY --from=builder $JAZZER_API_PATH $JAZZER_API_PATH
|
||||||
|
COPY --from=builder $JAZZER_JUNIT_PATH $JAZZER_JUNIT_PATH
|
||||||
|
|
||||||
RUN chmod 755 /usr/local/bin && chmod 755 /usr/local/lib
|
RUN chmod 755 /usr/local/bin && chmod 755 /usr/local/lib
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue