Dockerfile in uffizzi-cli-0.2.2 vs Dockerfile in uffizzi-cli-0.3.2
- old
+ new
@@ -1,23 +1,46 @@
-FROM ruby:3.0.2-alpine3.14
+FROM ruby:3.0.3-alpine AS builder
-RUN apk update && apk upgrade
-RUN apk add bash
-RUN apk add curl-dev ruby-dev build-base git curl ruby-json openssl groff mandoc man-pages
+RUN apk --update add --no-cache \
+ curl-dev \
+ ruby-dev \
+ build-base \
+ git \
+ curl \
+ ruby-json \
+ openssl \
+ groff \
+ mandoc \
+ man-pages \
+ bash
RUN mkdir -p /gem
WORKDIR /gem
ENV GEM_HOME="/usr/local/bundle"
ENV PATH $GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH
-RUN gem install uffizzi-cli
-RUN gem install bundler -v 2.3.8
+RUN gem install bundler -v 2.3.9
-COPY lib/uffizzi/version.rb /gem/lib/uffizzi/
-COPY uffizzi.gemspec /gem/
-COPY Gemfile* /gem/
+COPY lib/uffizzi/version.rb ./lib/uffizzi/
+COPY uffizzi.gemspec .
+COPY Gemfile* .
RUN bundle install --jobs 4
-COPY . /gem
+COPY . .
-CMD ["uffizzi"]
+RUN bundle exec rake install
+
+# M-M-M-M-MULTISTAGE!!!
+FROM ruby:3.0.3-alpine
+
+RUN apk --update add --no-cache mandoc
+
+WORKDIR /root/
+
+COPY docker-entrypoint.sh .
+RUN chmod +x docker-entrypoint.sh
+
+COPY --from=builder /gem/pkg/uffizzi-cli* .
+RUN gem install ./uffizzi-cli*
+
+ENTRYPOINT ["/root/docker-entrypoint.sh"]