Optimized adservice Image Size (#67)
* adservice: Reduced docker image size to ~165MB (down from ~886MB) by switching to alpine and using multi stage builds * adservice: Changed install of glibc in builder to not require untrusted packages * 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
7f40378ecc
commit
571285d9aa
1 changed files with 12 additions and 6 deletions
|
@ -1,16 +1,22 @@
|
|||
FROM openjdk:8
|
||||
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 && \
|
||||
chmod +x /bin/grpc_health_probe
|
||||
FROM openjdk:8-slim as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Next three steps are for caching dependency downloads
|
||||
# to improve subsequent docker build.
|
||||
COPY ["build.gradle", "gradlew", "./"]
|
||||
COPY gradle gradle
|
||||
RUN ./gradlew downloadRepos
|
||||
|
||||
COPY . .
|
||||
RUN ./gradlew installDist
|
||||
|
||||
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 && \
|
||||
chmod +x /bin/grpc_health_probe
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app .
|
||||
|
||||
EXPOSE 9555
|
||||
ENTRYPOINT ["/app/build/install/hipstershop/bin/AdService"]
|
||||
|
|
Loading…
Reference in a new issue