Skip to content

Commit 598c48e

Browse files
authored
[CI] Updated tflm-ci docker image (#3200)
This update improves the `tflm-ci` Docker image and CI stability using it: - Pinned CI for Deterministic Builds: All GitHub workflows now use the pinned `tflm-ci:0.6.3` image. This replaces the latest tag to ensure all CI runs are deterministic. - Upgraded Base Image: The Dockerfile now uses Debian bookworm instead of bullseye. - Updated Dependencies: - `bazelisk` is updated to version 1.27.0. - `yapf` is updated to 0.40.2 for consistency with [this](https://github.com/tensorflow/tflite-micro/blob/eacd4c404d22ffce40b1f164fc77c6831f80d561/third_party/python_requirements.txt#L1170). - Improved Documentation: The Dockerfile comment is expanded to include instructions on how to upload new image versions to ghcr.io. BUG=Clean-up
1 parent eacd4c4 commit 598c48e

File tree

6 files changed

+31
-18
lines changed

6 files changed

+31
-18
lines changed

.github/workflows/check_tflite_files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
echo "${PR_FILES}" >> tmp_pull_request_files.txt
3535
rm -rf .git
3636
echo ${{ secrets.tflm-bot-token }} | docker login ghcr.io -u tflm-bot --password-stdin
37-
docker run --rm -v `pwd`:/tflite-micro -w /tflite-micro ghcr.io/tflm-bot/tflm-ci:latest python3 ci/check_tflite_files.py tmp_pull_request_files.txt
37+
docker run --rm -v `pwd`:/tflite-micro -w /tflite-micro ghcr.io/tflm-bot/tflm-ci:0.6.3 python3 ci/check_tflite_files.py tmp_pull_request_files.txt
3838
TFLITE_FILE_TEST_STATUS=$?
3939
rm -f tmp_pull_request_files.txt
4040
exit ${TFLITE_FILE_TEST_STATUS}

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ jobs:
259259
with:
260260
ref: ${{ inputs.trigger-sha }}
261261
- name: Test
262-
uses: docker://ghcr.io/tflm-bot/tflm-ci:latest
262+
uses: docker://ghcr.io/tflm-bot/tflm-ci:0.6.3
263263
with:
264264
args: /bin/sh -c tensorflow/lite/micro/tools/ci_build/test_cortex_m_qemu.sh tflite-micro/
265265

@@ -275,7 +275,7 @@ jobs:
275275
with:
276276
ref: ${{ inputs.trigger-sha }}
277277
- name: Check
278-
uses: docker://ghcr.io/tflm-bot/tflm-ci:latest
278+
uses: docker://ghcr.io/tflm-bot/tflm-ci:0.6.3
279279
with:
280280
args: /bin/sh -c "git config --global --add safe.directory /github/workspace && tensorflow/lite/micro/tools/ci_build/test_code_style.sh"
281281

.github/workflows/riscv.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
python-version: '3.10'
2525
- uses: actions/checkout@v3
2626
- name: Test
27-
uses: docker://ghcr.io/tflm-bot/tflm-ci:latest
27+
uses: docker://ghcr.io/tflm-bot/tflm-ci:0.6.3
2828
with:
2929
args: /bin/sh -c tensorflow/lite/micro/tools/ci_build/test_riscv.sh
3030

.github/workflows/riscv_postmerge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ jobs:
3232
with:
3333
ref: ${{ inputs.trigger-sha }}
3434
- name: Test
35-
uses: docker://ghcr.io/tflm-bot/tflm-ci:latest
35+
uses: docker://ghcr.io/tflm-bot/tflm-ci:0.6.3
3636
with:
3737
args: /bin/sh -c tensorflow/lite/micro/tools/ci_build/test_riscv.sh

ci/Dockerfile.micro

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
1-
# This docker container can be used to run all the TFLM CI checks.
1+
# TFLM CI Docker Container
22
#
3-
# It is only used as part of the GitHub workflows to test for code-style. But
4-
# the container is available and ready for use to run all the checks locally,
5-
# in case that is useful for debugging. See all the versions at
6-
# https://github.com/users/TFLM-bot/packages/container/tflm-ci/versions
3+
# This container includes all dependencies for TFLM CI checks and is
4+
# recommended for local debugging to ensure a consistent environment.
75
#
8-
# docker pull ghcr.io/tflm-bot/tflm-ci:<version>
6+
# * Pull a prebuilt image:
7+
# See all versions: https://github.com/users/TFLM-bot/packages/container/tflm-ci/versions
8+
# docker pull ghcr.io/tflm-bot/tflm-ci:<version>
99
#
10-
# Build you own container with:
11-
# docker build -f ci/Dockerfile.micro -t tflm-ci .
10+
# * Build locally:
11+
# (Run from the root of the TFLM repository)
12+
# docker build -f ci/Dockerfile.micro -t tflm-ci .
1213
#
14+
# * Build and upload to GHCR.IO:
15+
# (Run from the root of the TFLM repository)
16+
# (Update the TFLM_CI_VERSION variable below to your target version)
17+
# export TFLM_CI_VERSION=0.6.3
18+
# docker build -f ci/Dockerfile.micro -t ghcr.io/tflm-bot/tflm-ci:$TFLM_CI_VERSION .
19+
# docker push ghcr.io/tflm-bot/tflm-ci:$TFLM_CI_VERSION
20+
# (And you need to update github workflows to use this version.)
21+
#
22+
# * Run locally for debugging:
23+
# (Mounts local repo and opens a shell)
24+
# (Run from the root of the TFLM repository)
25+
# docker run -it --rm -v $(pwd):/opt/tflm -w /opt/tflm tflm-ci /bin/bash
26+
1327
# Use a prebuilt Python image instead of base Ubuntu to speed up the build process,
1428
# since it has all the build dependencies we need for Micro and downloads much faster
1529
# than the install process.
1630

1731
# Using a multistage build so that the build tools required for stage 1 don't make the
1832
# CI container unnecessarily large.
19-
FROM python:3.10-bullseye AS qemu_builder
33+
FROM python:3.10-bookworm AS qemu_builder
2034
RUN apt-get update
2135

2236
RUN apt-get install -y ninja-build wget xz-utils
@@ -28,7 +42,7 @@ COPY ci/install_qemu.sh ./
2842
RUN ./install_qemu.sh /tmp/qemu_install
2943

3044
# This stage is the final CI container.
31-
FROM python:3.10-bullseye AS tflm-ci
45+
FROM python:3.10-bookworm AS tflm-ci
3246

3347
RUN apt-get update
3448

@@ -52,7 +66,7 @@ RUN git config --global --add safe.directory /github/workspace
5266

5367
# Install yapf to check for Python formatting as part of the TFLM continuous
5468
# integration.
55-
RUN pip install yapf==0.32.0
69+
RUN pip install yapf==0.40.2
5670

5771
# Pillow was added first for the C array generation as a result of the following
5872
# PRs:

ci/install_bazelisk.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
# ==============================================================================
1616

1717
set -e
18-
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64
18+
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-linux-amd64
1919
mv bazelisk-linux-amd64 bazel
2020
chmod +x bazel
2121
mv bazel /usr/local/bin
22-

0 commit comments

Comments
 (0)