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
32 lines
1.1 KiB
Docker
32 lines
1.1 KiB
Docker
FROM ubuntu:jammy AS build
|
|
|
|
# Install build dependencies:
|
|
RUN apt-get update && apt-get install -y --no-install-recommends git build-essential libssl-dev libz-dev ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Clone repo at the commit ID we expect to patch:
|
|
RUN git clone https://github.com/giltene/wrk2.git /tmp/wrk2 \
|
|
&& cd /tmp/wrk2 \
|
|
&& git reset --hard 44a94c17d8e6a0bac8559b53da76848e430cb7a7
|
|
|
|
# Update LuaJIT to an ARM-compatible version:
|
|
RUN git clone https://luajit.org/git/luajit.git /tmp/luajit \
|
|
&& cd /tmp/luajit \
|
|
&& git reset --hard 224129a8e64bfa219d35cd03055bf03952f167f6 \
|
|
&& cp -ar /tmp/luajit/* /tmp/wrk2/deps/luajit/
|
|
|
|
# Patch files to make them ARM-compatible:
|
|
RUN cd /tmp/wrk2 \
|
|
&& sed -ri 's/#include <x86intrin.h>//g' src/hdr_histogram.c \
|
|
&& sed -ri 's/\bluaL_reg\b/luaL_Reg/g' src/script.c
|
|
|
|
# Make.
|
|
RUN cd /tmp/wrk2 && make
|
|
|
|
FROM ubuntu:jammy
|
|
RUN set -x \
|
|
&& apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
wget ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY --from=build /tmp/wrk2/wrk /bin/wrk2
|