Skip to content

build: switch base images from Alpine to Debian Slim - #3694

Open
ryanmelt wants to merge 3 commits into
mainfrom
pr1-alpine-to-debian
Open

build: switch base images from Alpine to Debian Slim#3694
ryanmelt wants to merge 3 commits into
mainfrom
pr1-alpine-to-debian

Conversation

@ryanmelt

Copy link
Copy Markdown
Member

Stacked PR 1 of 5 — base: main. First of a series that splits #3688 into reviewable chunks; please review/land in order.

Switches all container base images from Alpine to Debian Slim. Zero bridge coupling — standalone and mergeable on its own; CI is the real proof.

Reviewer focus

  • apk→apt package mapping (build-basebuild-essential, libxslt-devlibxslt1-dev, busybox ncnetcat-openbsd, dropped libc6-compat/openblas-dev)
  • GEM_HOME reset off the official ruby image
  • deb822 vs sources.list mirror rewrite
  • rbspy vendored tarballs (no Debian package)
  • shbash shoreman
  • Redis CLI test uses printf instead of busybox echo -e (dash prints -e literally, breaking the AUTH line)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.32%. Comparing base (d43e1eb) to head (60274c1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3694      +/-   ##
==========================================
+ Coverage   79.30%   79.32%   +0.02%     
==========================================
  Files         885      885              
  Lines       65365    65365              
  Branches     2543     2591      +48     
==========================================
+ Hits        51838    51853      +15     
+ Misses      12859    12844      -15     
  Partials      668      668              
Flag Coverage Δ
frontend 63.77% <ø> (+0.14%) ⬆️
python 81.53% <ø> (+<0.01%) ⬆️
ruby-api 82.11% <ø> (-0.07%) ⬇️
ruby-backend 84.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- **Python**: We support versions in bugfix and security status as defined by the [Python Release Cycle](https://devguide.python.org/versions/).

Our Docker containers are built on [Alpine Linux](https://alpinelinux.org/releases/) base images. The versions of Ruby and Python available in our containers are dependent on what is packaged in the Alpine releases. Our current Alpine version is [3.23](https://alpinelinux.org/posts/Alpine-3.23.0-released.html) which uses Ruby 3.4 and Python 3.12.
Our Docker containers are built on [Debian](https://www.debian.org/releases/) slim base images. The version of Python available in our containers is dependent on what is packaged in the Debian release, while Ruby comes from the official `ruby` slim image. Our current Debian release is [trixie](https://www.debian.org/releases/trixie/) which uses Ruby 3.4 and Python 3.13.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already building on 3.13 so I think that's fine but we should call it out in the release notes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Comment thread openc3-node/Dockerfile Outdated
apk add npm && \
RUN apt-get update && \
apt-get install -y --no-install-recommends nodejs npm && \
npm install --global --ignore-scripts pnpm@10.34.5 && \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be pnpm 11 when you resolve conflicts

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.

Comment thread openc3-redis/Dockerfile Outdated
ARG OPENC3_DEPENDENCY_REGISTRY=docker.io
ARG OPENC3_REDIS_IMAGE=valkey/valkey
ARG OPENC3_REDIS_VERSION=9.1.1-alpine
ARG OPENC3_REDIS_VERSION=9.1.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why backwards? valkey 9.1.1 shoudl exist for debian

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mistake. Updated to 9.1.1-trixie to be specific.

Comment thread openc3-cosmos-cmd-tlm-api/Dockerfile Outdated
rm -rf /usr/local/lib/ruby/gems/*/cache/* /var/lib/apt/lists/* /var/cache/apt/* /tmp/* /var/tmp/*

RUN ["chown", "-R", "openc3:openc3", "/src/"]
COPY --chown=${IMAGE_USER}:${IMAGE_GROUP} ./ ./

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're already doing a COPY on line 11. I think this can be removed but keep the chown to reset ownership of Gemfile.lock.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed copy and changed chown to just Gemfile.lock

rm -rf /usr/local/lib/ruby/gems/*/cache/* /var/lib/apt/lists/* /var/cache/apt/* /tmp/* /var/tmp/*

RUN ["chown", "-R", "openc3:openc3", "/src/"]
COPY --chown=${IMAGE_USER}:${IMAGE_GROUP} ./ ./

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're already doing a COPY on line 14. I think this can be removed but keep the chown to reset ownership of Gemfile.lock.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed copy and changed chown to just Gemfile.lock

Comment thread openc3-node/Dockerfile Outdated
RUN apk update && \
apk add npm && \
RUN apt-get update && \
apt-get install -y --no-install-recommends nodejs npm && \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trixie gives Node v20.19.2. Alpine was Node v24.18.1 and we're Node 24 in all our build actions. Update node to v24.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating to pull node 24 from the official docker node image. Note that UBI is still Node 22.

Comment thread openc3/Dockerfile
&& chmod -R 777 /gems/ \
&& chmod -R 777 /plugins/ \
&& chmod -R 777 /openc3/
&& chmod 777 /gems /plugins /openc3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more -R is behavior change. Line 14 and 34 cover /gems, /openc3/lib, and /openc3gems. But /openc3/python is going to have root owned files. Does this matter?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gems and plugins are folders for supporting volume mounts so the -R does nothing. /openc3 ownership doesn't matter as it is readable and the container is not writable.

Comment thread openc3-redis/Dockerfile
ARG OPENC3_REDIS_IMAGE=valkey/valkey
ARG OPENC3_REDIS_VERSION=9.1.1-alpine
ARG OPENC3_REDIS_VERSION=9.1.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should add the ARG APT_URL=http://deb.debian.org treatment like the other Dockerfiles

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Comment thread openc3-ruby/Dockerfile
libtool \
libxml2-dev \
libxslt-dev \
openblas-dev \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude thinks removing this will break a source build install of numpy/scipy. But I think we're always installing wheels so ok?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since not musl we can use binary wheels.

@jmthomas

jmthomas commented Aug 12, 2026

Copy link
Copy Markdown
Member

I calculated the differences between 7.3.0 and building this branch for image sizes. The results are as follows (compressed / pull size from registry):

┌─────────────────────────────────┬─────────┬─────────┬──────────┬────────┐
│              image              │  7.3.0  │   new   │  delta   │        │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-ruby                     │ 316 MiB │ 379 MiB │      +63 │ +20.0% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-buckets                  │      70 │      95 │      +25 │ +35.1% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-redis                    │      20 │      43 │      +22 │  +109% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-node                     │     351 │     438 │      +87 │ +24.7% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-operator                 │     568 │     687 │     +118 │ +20.8% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-cosmos-cmd-tlm-api       │     577 │     696 │     +119 │ +20.5% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-cosmos-script-runner-api │     577 │     696 │     +119 │ +20.6% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-cosmos-init              │     691 │     808 │     +117 │ +17.0% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-traefik                  │      51 │      51 │        0 │     0% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ openc3-tsdb                     │     163 │     163 │        0 │     0% │
├─────────────────────────────────┼─────────┼─────────┼──────────┼────────┤
│ sum                             │    3386 │    4055 │ +670 MiB │ +19.8% │
└─────────────────────────────────┴─────────┴─────────┴──────────┴────────┘

Here's the uncompressed per image results:

┌─────────────────────────────────┬───────────┬─────────┬─────────┬────────┐
│              image              │   7.3.0   │   new   │  delta  │        │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-ruby                     │   1.22 GB │ 1.47 GB │   +0.25 │ +20.5% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-base                     │ 2.34 GB * │ 2.88 GB │   +0.54 │ +23.1% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-operator                 │   2.34 GB │ 2.88 GB │   +0.54 │ +23.1% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-cosmos-cmd-tlm-api       │   2.39 GB │ 2.92 GB │   +0.53 │ +22.2% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-cosmos-script-runner-api │   2.38 GB │ 2.92 GB │   +0.54 │ +22.7% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-cosmos-init              │   2.67 GB │ 3.20 GB │   +0.53 │ +19.9% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-node (build-only)        │   1.37 GB │ 1.84 GB │   +0.47 │ +34.3% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-buckets                  │    180 MB │  306 MB │ +126 MB │ +70.0% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-redis                    │   80.1 MB │  190 MB │ +110 MB │  +137% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-traefik                  │    236 MB │  236 MB │       0 │     0% │
├─────────────────────────────────┼───────────┼─────────┼─────────┼────────┤
│ openc3-tsdb                     │    565 MB │  565 MB │       0 │     0% │
└─────────────────────────────────┴───────────┴─────────┴─────────┴────────┘

However since there are shared layers they don't sum. The total for pulling all the core images works out as:

┌─────────────────────────────────────────────────────────────┬─────────┬─────────┬───────────────────┐
│                                                             │  7.3.0  │   new   │       delta       │
├─────────────────────────────────────────────────────────────┼─────────┼─────────┼───────────────────┤
│ shared base chain (ruby → base)                             │ 2.34 GB │ 2.88 GB │             +0.54 │
├─────────────────────────────────────────────────────────────┼─────────┼─────────┼───────────────────┤
│ service deltas (cmd-tlm-api, script-runner, init, operator) │ 0.42 GB │ 0.42 GB │                ~0 │
├─────────────────────────────────────────────────────────────┼─────────┼─────────┼───────────────────┤
│ standalone (buckets, redis, traefik, tsdb)                  │ 1.06 GB │ 1.30 GB │             +0.24 │
├─────────────────────────────────────────────────────────────┼─────────┼─────────┼───────────────────┤
│ total                                                       │ 3.82 GB │ 4.59 GB │ +0.78 GB (+20.3%) │
└─────────────────────────────────────────────────────────────┴─────────┴─────────┴───────────────────┘

So about a 20% increase.

Uncompressed the rootfs on debian is about 100MB bigger and building Ruby from source results in 94MB. The rest is noise.

Is there any reason we wouldn't keep redis and buckets on Alpine? There's no real advantage to moving them to debian except for maintainability. We already have independent traefik (Alpine) and tsdb (fedora-minimal) images.

@mcosgriff

Copy link
Copy Markdown
Contributor

Curious why we don't just support the RHEL UBI images

Comment thread openc3-ruby/Dockerfile
# Not packaged for Debian, so ship the prebuilt release binary per architecture.
ARG RBSPY_VERSION=0.49.0
ARG TARGETARCH
COPY rbspy-*-unknown-linux-gnu-${RBSPY_VERSION}.tar.gz /tmp/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk if it belongs in this PR or is a separate issue entirely, but we should be verifying the integrity of any binaries in the repo. Probably worth a separate discussion

@ryanmelt

Copy link
Copy Markdown
Member Author

Ironbank has poor support for ARM64, which is a major factor for not just supporting RHEL UBI. Also UBI tends to have worse package support.

@sonarqubecloud

sonarqubecloud Bot commented Aug 16, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
6 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@ryanmelt
ryanmelt requested a review from jmthomas August 18, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants