Skip to content

Commit f00bd9c

Browse files
authored
Merge pull request #149 from schwankner/fix/arm64-ubuntu-base
fix: ubuntu:24.04 base image + remove platforms: flag to fix ARM64 on RK3588
2 parents f87dc3b + 900d03a commit f00bd9c

2 files changed

Lines changed: 35 additions & 13 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,14 @@ jobs:
4848
# Set up BuildKit Docker container builder to be able to build
4949
# multi-platform images and export cache
5050
# https://github.com/docker/setup-buildx-action
51+
#
52+
# NOTE: Do NOT set `platforms: linux/arm64` here — on a native
53+
# ubuntu-24.04-arm runner this forces QEMU-backed cross-compilation
54+
# even though the runner is natively arm64, causing the docker-container
55+
# builder to pull and cache amd64 base layers and contaminate subsequent
56+
# arm64 builds. Omitting the flag builds for the runner's native arch.
5157
- name: Set up Docker Buildx
5258
uses: docker/setup-buildx-action@v4
53-
with:
54-
platforms: linux/arm64
5559

5660
# Login against a Docker registry except on PR
5761
# https://github.com/docker/login-action
@@ -73,6 +77,10 @@ jobs:
7377

7478
# Build and push Docker image with Buildx
7579
# https://github.com/docker/build-push-action
80+
#
81+
# NOTE: Do NOT set `platforms: linux/arm64` here — same reason as above.
82+
# The cache key uses the -arm64 suffix to avoid reusing the stale amd64
83+
# cache that existed before the runner switch to ubuntu-24.04-arm.
7684
- name: Build and push Docker image
7785
id: build-and-push
7886
uses: docker/build-push-action@v7
@@ -81,9 +89,8 @@ jobs:
8189
push: ${{ github.event_name != 'pull_request' }}
8290
tags: ${{ steps.meta.outputs.tags }}
8391
labels: ${{ steps.meta.outputs.labels }}
84-
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:buildcache
85-
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:buildcache,mode=max
86-
platforms: linux/arm64
92+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:buildcache-arm64
93+
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:buildcache-arm64,mode=max
8794

8895
# Sign the resulting Docker image digest except on PRs.
8996
# This will only write to the public Rekor transparency log when the Docker

Dockerfile

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1-
FROM python:3.12-slim
1+
FROM ubuntu:24.04
2+
3+
# RK3588 (Cortex-A76/A55) is ARMv8.2-A — it does NOT support Pointer
4+
# Authentication (PAC, ARMv8.3-A). Debian Trixie ARM64 packages
5+
# (python:3.12-slim) are compiled with PAC guards; the kernel returns
6+
# ENOEXEC for those binaries on RK3588, causing "exec format error" at
7+
# container startup. Ubuntu 24.04 ARM64 packages do NOT use PAC and
8+
# run correctly on ARMv8.2-A hardware.
9+
ENV DEBIAN_FRONTEND=noninteractive
210

311
RUN apt-get update \
4-
&& apt-get install -y --no-install-recommends libgomp1 wget curl sudo git build-essential \
5-
&& apt-get install -y ffmpeg libsm6 libxext6 \
12+
&& apt-get install -y --no-install-recommends \
13+
python3.12 python3.12-dev python3-pip python3.12-venv \
14+
libgomp1 wget curl sudo git build-essential \
15+
ffmpeg libsm6 libxext6 \
616
&& rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
717

8-
# Fix setupttols version to prevent error: No module named 'pkg_resources'
9-
RUN python -m pip --no-cache-dir install "setuptools<82.0.0"
18+
# Use a virtual environment to avoid Ubuntu 24.04's PEP 668
19+
# "externally-managed-environment" restriction.
20+
RUN python3 -m venv /opt/venv
21+
ENV PATH="/opt/venv/bin:$PATH"
22+
23+
RUN pip install --no-cache-dir --upgrade pip \
24+
&& pip install --no-cache-dir "setuptools<82.0.0"
1025

1126
WORKDIR /opt/rkllama
1227

@@ -18,13 +33,13 @@ RUN chmod 755 /usr/lib/librkllmrt.so && ldconfig
1833
COPY ./src/rkllama/lib/librknnrt.so /usr/lib/
1934
RUN chmod 755 /usr/lib/librknnrt.so && ldconfig
2035

21-
# Copy the source and other resourvces of the RKllama project
36+
# Copy the source and other resources of the RKllama project
2237
COPY ./src /opt/rkllama/src
2338
RUN mkdir /opt/rkllama/models
2439
COPY README.md LICENSE pyproject.toml /opt/rkllama/
2540

26-
# Install RKLlama project
27-
RUN python -m pip --no-cache-dir install .
41+
# Install RKllama project
42+
RUN pip install --no-cache-dir .
2843

2944
EXPOSE 8080
3045

0 commit comments

Comments
 (0)