From e10f1f1efeb12dd90490287bd2283a23c701b7bc Mon Sep 17 00:00:00 2001 From: Colin Nelson Date: Sat, 6 Oct 2018 14:07:21 -0700 Subject: [PATCH] adservice: Refactored Dockerfile to be a multi stage build. The 'build' step runs from openjdk:8-slim, but the final image is alpine based. We can get away from this since java runs in a vm & the architecture of the images doesn't change between biuld steps --- src/adservice/Dockerfile | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/adservice/Dockerfile b/src/adservice/Dockerfile index caac9e0..78b0452 100644 --- a/src/adservice/Dockerfile +++ b/src/adservice/Dockerfile @@ -1,19 +1,7 @@ -FROM openjdk:8-alpine as base - -FROM base as builder +FROM openjdk:8-slim as builder WORKDIR /app -# This is because the protoc-gen-grpc-java library -# is a glibc compiled binary and alpine is -# based on musl-libc -RUN apk --no-cache add ca-certificates && \ - wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \ - wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk && \ - apk add glibc-2.28-r0.apk - -# Next three steps are for caching dependency downloads -# to improve subsequent docker build. COPY ["build.gradle", "gradlew", "./"] COPY gradle gradle RUN ./gradlew downloadRepos @@ -21,7 +9,7 @@ RUN ./gradlew downloadRepos COPY . . RUN ./gradlew installDist -FROM base +FROM openjdk:8-alpine RUN GRPC_HEALTH_PROBE_VERSION=v0.1.0-alpha.1 && \ wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \