forked from tensorflow/tflite-micro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.micro
80 lines (64 loc) · 2.78 KB
/
Dockerfile.micro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# This docker container can be used to run all the TFLM CI checks.
#
# It is only used as part of the GitHub workflows to test for code-style. But
# the container is available and ready for use to run all the checks locally,
# in case that is useful for debugging. See all the versions at
# https://github.com/users/TFLM-bot/packages/container/tflm-ci/versions
#
# docker pull ghcr.io/tflm-bot/tflm-ci:<version>
#
# Build you own container with:
# docker build -f ci/Dockerfile.micro -t tflm-ci .
#
# Use a prebuilt Python image instead of base Ubuntu to speed up the build process,
# since it has all the build dependencies we need for Micro and downloads much faster
# than the install process.
# Using a multistage build so that the build tools required for stage 1 don't make the
# CI container unnecessarily large.
FROM python:3.10-bullseye AS qemu_builder
RUN apt-get update
RUN apt-get install -y ninja-build wget xz-utils
RUN apt-get install -y libglib2.0-dev
RUN apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
COPY ci/install_qemu.sh ./
# Installs all built files into /qemu_install rather than /usr/local default.
RUN ./install_qemu.sh /tmp/qemu_install
# This stage is the final CI container.
FROM python:3.10-bullseye as tflm-ci
RUN apt-get update
RUN apt-get install -y zip xxd sudo
RUN apt install -y lsb-release wget software-properties-common gnupg
RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 16
RUN ln -s /usr/bin/clang-16 /usr/bin/clang
RUN ln -s /usr/bin/clang++-16 /usr/bin/clang++
RUN apt-get install clang-format-16
RUN ln -s /usr/bin/clang-format-16 /usr/bin/clang-format
# Needed when using the Dockerfile locally.
RUN git config --global --add safe.directory /opt/tflm
# Needed when the docker container is used with GitHub actions.
RUN git config --global --add safe.directory /github/workspace
# Install yapf to check for Python formatting as part of the TFLM continuous
# integration.
RUN pip install yapf==0.32.0
# Pillow was added first for the C array generation as a result of the following
# PRs:
# https://github.com/tensorflow/tflite-micro/pull/337
# https://github.com/tensorflow/tflite-micro/pull/410
RUN pip install Pillow
# necessary bits for create_size_log scripts
RUN pip install pandas
RUN pip install matplotlib
RUN pip install six
# Install Renode test dependencies
RUN pip install pyyaml requests psutil robotframework==4.0.1
# Install QEMU from build container qemu_builder into tflm-ci container.
# We're using a two stage build to keep the CI container smaller.
WORKDIR /usr/local
# Merge built files into /usr/local so that the path is already setup.
COPY --from=qemu_builder /tmp/qemu_install/. .
WORKDIR /
COPY ci/*.sh /install/
RUN /install/install_bazelisk.sh
RUN /install/install_buildifier.sh