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
This commit is contained in:
parent
27cd7cab28
commit
e10f1f1efe
1 changed files with 2 additions and 14 deletions
|
@ -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 && \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue