Skip to content

Commit

Permalink
multistage build example
Browse files Browse the repository at this point in the history
also pin final image on tagged alpine version
~50 ish mb size reduction
  • Loading branch information
mcrmonkey committed Apr 28, 2023
1 parent f0506d5 commit 1a65275
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
FROM alpine:latest
LABEL MAINTAINER ant@manchestermonkey.co.uk
ARG CEREBROVER=0.9.4

RUN apk update && apk add bash openjdk8-jre
FROM alpine:latest as builder

ENV CEREBRO_VER 0.9.4
ARG CEREBROVER
ENV CEREBRO_VER=$CEREBROVER

ADD https://github.com/lmenezes/cerebro/releases/download/v${CEREBRO_VER}/cerebro-${CEREBRO_VER}.tgz /

RUN mkdir /cerebro && tar -zxf cerebro-${CEREBRO_VER}.tgz --strip-components 1 -C /cerebro

WORKDIR /cerebro

EXPOSE 9000
FROM alpine:3.17
LABEL MAINTAINER ant@manchestermonkey.co.uk

ARG CEREBROVER
ENV CEREBRO_VER=$CEREBROVER

RUN apk add --no-cache bash openjdk8-jre

COPY --from=builder /cerebro /cerebro

WORKDIR /cerebro

ENTRYPOINT ["/cerebro/bin/cerebro"]
EXPOSE 9000/tcp

ENTRYPOINT ["/cerebro/bin/cerebro"]

0 comments on commit 1a65275

Please sign in to comment.