mirror of
https://github.com/vee1e/tflite-micro.git
synced 2026-09-01 09:51:22 +00:00
86 lines
2.8 KiB
Text
86 lines
2.8 KiB
Text
# TFLM CI Docker Container
|
|
#
|
|
# This container includes all dependencies for TFLM CI checks and is
|
|
# recommended for local debugging to ensure a consistent environment.
|
|
#
|
|
# === Usage ===
|
|
#
|
|
# --- Pull a prebuilt image ---
|
|
# See all versions: https://github.com/users/TFLM-bot/packages/container/tflm-ci/versions
|
|
# docker pull ghcr.io/tflm-bot/tflm-ci:<version>
|
|
#
|
|
# --- Build locally ---
|
|
# (Run from the root of the TFLM repository)
|
|
# docker build -f ci/Dockerfile.micro -t tflm-ci .
|
|
#
|
|
# --- Build and upload to GHCR.IO ---
|
|
# (Run from the root of the TFLM repository)
|
|
# export TFLM_CI_VERSION=0.6.7
|
|
# docker build --no-cache -f ci/Dockerfile.micro -t ghcr.io/tflm-bot/tflm-ci:$TFLM_CI_VERSION .
|
|
# docker push ghcr.io/tflm-bot/tflm-ci:$TFLM_CI_VERSION
|
|
#
|
|
# --- Run locally for debugging ---
|
|
# (Mounts local repo and opens a shell)
|
|
# (Run from the root of the TFLM repository)
|
|
# docker run -it --rm -v $(pwd):/opt/tflm -w /opt/tflm tflm-ci /bin/bash
|
|
#
|
|
|
|
# Use a prebuilt Python image to speed up the build process.
|
|
FROM python:3.10-bookworm
|
|
|
|
# Install qemu-user from bookworm-backports to address a known bug:
|
|
# https://gitlab.com/qemu-project/qemu/-/issues/1697
|
|
RUN echo "deb http://deb.debian.org/debian bookworm-backports main" > /etc/apt/sources.list.d/backports.list && \
|
|
apt-get update && \
|
|
apt-get install -y --no-install-recommends -t bookworm-backports qemu-user && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install all required system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
gnupg \
|
|
lsb-release \
|
|
software-properties-common \
|
|
sudo \
|
|
wget \
|
|
xxd \
|
|
zip \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install LLVM/Clang and create symlinks
|
|
RUN wget https://apt.llvm.org/llvm.sh \
|
|
&& chmod +x llvm.sh \
|
|
&& ./llvm.sh 21 \
|
|
&& rm llvm.sh \
|
|
&& apt-get update && apt-get install -y clang-21 clang++-21 clang-format-21 \
|
|
&& ln -s /usr/bin/clang-21 /usr/bin/clang \
|
|
&& ln -s /usr/bin/clang++-21 /usr/bin/clang++ \
|
|
&& ln -s /usr/bin/clang-format-21 /usr/bin/clang-format \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install all Python dependencies
|
|
# - yapf to check for Python formatting
|
|
# - Pillow was added first for the C array generation
|
|
# - pandas, and matplotlib for create_size_log scripts
|
|
# - pyyaml, requests, psutil, and robotframework for Renode test
|
|
RUN pip install --no-cache-dir --upgrade pip && \
|
|
pip install --no-cache-dir \
|
|
matplotlib \
|
|
pandas \
|
|
Pillow \
|
|
psutil \
|
|
pyyaml \
|
|
requests \
|
|
robotframework==4.0.1 \
|
|
yapf==0.40.2
|
|
|
|
# Copy and run install scripts, then clean them up
|
|
WORKDIR /
|
|
COPY ci/*.sh /install/
|
|
RUN /install/install_bazelisk.sh && \
|
|
/install/install_buildifier.sh && \
|
|
rm -rf /install
|
|
|
|
# Configure git safe directories
|
|
RUN git config --system --add safe.directory '*'
|