mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 17:33:03 -05:00
perf(docker): shrink image by 28% using ubi9-micro (109 MB to 78 MB compressed) (#3085)
* perf(docker): move the native image to ubi9-micro The binary needs only libc, and since #3037 the entrypoint needs only bash and coreutils. ubi9-micro has both at 7 MB compressed instead of ubi9-minimal's 40 MB. Measured on arm64 with the nightly-09042026 binary: 109 MB to about 78 MB compressed, 313 MB to 229 MB uncompressed. ubi9-micro has no useradd and no curl, so the user is one /etc/passwd line and the healthcheck is a bash /dev/tcp probe. Dockerfile.native gets the same runtime stage and loses its unused gosu tools stage. Dockerfile.compat needs microdnf, so it now starts from ubi9-minimal and copies /app out of the native image. * chore(docker): share the health probe and split the compat tools stage The bash health probe is now docker/healthcheck.sh, used by all three Dockerfiles. Dockerfile.compat gets a version independent tools stage; the aws CLI shim test and the cache warm job build target: tools, so they pull no floci image and their cached layers stay stable. ARG VERSION and the native RUN steps move so only the binary copy changes between builds. * fix(docker): copy healthcheck.sh into the compat image from the build context * ci(compat): build the whole compat image on pull requests and check it starts healthy
This commit is contained in:
1 parent
15b401032d
commit
64f06e090f
8 files changed
+103
-75
No files matched your search
@@ -9,6 +9,7 @@ on:
|
||||
- 'docker/Dockerfile.compat'
|
||||
- 'docker/entrypoint.sh'
|
||||
- 'docker/localstack-parity.sh'
|
||||
- 'docker/healthcheck.sh'
|
||||
- 'compatibility-tests/**'
|
||||
- '.github/ci/compat-timing-report.py'
|
||||
- '.github/ci/compat-opentofu-drift-check.py'
|
||||
@@ -41,13 +42,27 @@ jobs:
|
||||
build-args: VERSION=latest
|
||||
load: true
|
||||
tags: floci-compat-shim-test
|
||||
# Read-only; warm-compat-caches.yml produces this scope on main. Unlike
|
||||
# floci-native above, these layers are worth caching: the image builds
|
||||
# FROM a published floci/floci tag and its cost is a microdnf install
|
||||
# that changes only when the Dockerfile does. Writing from here would
|
||||
# put a per-PR copy no other PR can read back into the budget.
|
||||
# Read-only; warm-compat-caches.yml produces this scope on main from the
|
||||
# tools stage. Unlike floci-native above, those layers are worth caching:
|
||||
# the tools stage depends only on ubi9-minimal and the Dockerfile, so it
|
||||
# changes only when the Dockerfile does. The final stage copies the binary
|
||||
# out of the published floci/floci:latest and is never cacheable. Writing
|
||||
# from here would put a per-PR copy no other PR can read back into the
|
||||
# budget.
|
||||
cache-from: type=gha,scope=compat-shim
|
||||
|
||||
- name: Compat image starts and reports healthy
|
||||
run: |
|
||||
docker run -d --name compat-smoke floci-compat-shim-test
|
||||
for _ in $(seq 1 30); do
|
||||
health=$(docker inspect -f '{{.State.Health.Status}}' compat-smoke)
|
||||
[ "$health" = healthy ] && break
|
||||
sleep 1
|
||||
done
|
||||
docker logs compat-smoke 2>&1 | tail -20
|
||||
docker rm -f compat-smoke >/dev/null
|
||||
[ "$health" = healthy ] || { echo "::error::compat image did not become healthy: $health"; exit 1; }
|
||||
|
||||
- name: Unflagged aws sqs call routes to AWS_ENDPOINT_URL
|
||||
run: |
|
||||
out=$(docker run --rm --entrypoint sh floci-compat-shim-test -c \
|
||||
|
||||
@@ -100,10 +100,10 @@ jobs:
|
||||
shim:
|
||||
name: warm / compat-shim
|
||||
# Produces the scope that compatibility.yml's compat-aws-cli-shim job reads.
|
||||
# Worth warming, unlike floci-native: this image builds FROM a published
|
||||
# floci/floci tag and its cost is a microdnf install of python3/pip/unzip that
|
||||
# changes only when the Dockerfile does — genuinely stable layers, with nothing
|
||||
# volatile above them.
|
||||
# Worth warming, unlike floci-native: the tools stage of Dockerfile.compat is a
|
||||
# microdnf install of python3/pip/unzip plus the aws CLI, and it depends only on
|
||||
# ubi9-minimal and the Dockerfile. Genuinely stable layers. The final stage,
|
||||
# which copies the binary out of a published floci/floci tag, is left out.
|
||||
runs-on: ubuntu-24.04-arm
|
||||
timeout-minutes: 20
|
||||
|
||||
@@ -119,8 +119,10 @@ jobs:
|
||||
context: .
|
||||
file: docker/Dockerfile.compat
|
||||
# Must match the consumer's build-args, or the layers key differently
|
||||
# and the warm is silently useless (compatibility.yml:38).
|
||||
# and the warm is silently useless (compatibility.yml:38). The consumer
|
||||
# builds the whole image; its tools layers key the same as this target.
|
||||
build-args: VERSION=latest
|
||||
target: tools
|
||||
# No `load:` — the image is discarded; only the cache is wanted.
|
||||
cache-from: type=gha,scope=compat-shim
|
||||
cache-to: type=gha,scope=compat-shim,mode=max
|
||||
Reference in new issue
Block a user