mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
Improve caching, linter compliance, and runtime image sizes. Notable image size reductions: - syscallbench: 160MB drop (~250 MB -> ~90 MB) by converting to a multi-stage build (AS build) to strip gcc and build tools from the runtime image. - absl: 80MB drop (665MB -> 486MB) by combining Bazel installer download, execution, and cleanup into a single RUN layer. - build-grpc : 450MB drop (1.38GB -> 830MB) by removing temporary bazel-*.sh installer scripts from intermediate layers and adding --no-install-recommends. - tensorflow: 60MB (1.29GB -> 1.23GB) drop by clearing /var/lib/apt/lists/* cache. - util: 56MB (137MB -> 81MB) by clearing apt cache lists. PiperOrigin-RevId: 958783211
28 lines
801 B
Docker
Executable File
28 lines
801 B
Docker
Executable File
# example based on https://github.com/errm/fib
|
|
FROM alpine:3.9 AS build
|
|
|
|
COPY Gemfile Gemfile.lock ./
|
|
|
|
RUN apk add --no-cache ruby ruby-dev ruby-bundler ruby-json build-base bash \
|
|
&& bundle install --frozen -j4 -r3 --no-cache --without development \
|
|
&& apk del --no-cache ruby-bundler \
|
|
&& rm -rf /usr/lib/ruby/gems/*/cache
|
|
|
|
FROM alpine:3.9 AS prod
|
|
|
|
COPY --from=build /usr/lib/ruby/gems /usr/lib/ruby/gems
|
|
RUN apk add --no-cache ruby ruby-json ruby-etc redis apache2-utils \
|
|
&& ruby -e "Gem::Specification.map.each do |spec| \
|
|
Gem::Installer.for_spec( \
|
|
spec, \
|
|
wrappers: true, \
|
|
force: true, \
|
|
install_dir: spec.base_dir, \
|
|
build_args: spec.build_args, \
|
|
).generate_bin \
|
|
end"
|
|
|
|
COPY . /app/.
|
|
|
|
STOPSIGNAL SIGINT
|