diff --git a/Dockerfile b/Dockerfile index 64def2e..22ddd18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,21 @@ -FROM ruby:2.4 +# Phase 1: Build the gem and all dependencies, needs C compiler +FROM ruby:2.4-alpine as builder -RUN gem install redis-stat +RUN apk add --no-cache build-base + +ENV GEM_HOME "/gems" + +RUN gem install -N redis-stat + +# Phase 2: Build the actual docker image, needs no C compiler -> much smaller image +FROM ruby:2.4-alpine + +RUN apk add --no-cache ncurses + +ENV GEM_HOME "/gems" +ENV PATH $GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH + +COPY --from=builder /gems /gems EXPOSE 63790 ENTRYPOINT ["redis-stat"]