-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
166 lines (143 loc) · 3.86 KB
/
Dockerfile
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# syntax=docker/dockerfile:1
ARG SMARTNIC_DPDK_IMAGE_URI
FROM ${SMARTNIC_DPDK_IMAGE_URI}
ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Configure local ubuntu mirror as package source
#COPY sources.list /etc/apt/sources.list
RUN <<EOT
set -ex
ln -fs /usr/share/zoneinfo/UTC /etc/localtime
apt update -y
apt upgrade -y
apt install -y --no-install-recommends \
bash-completion \
build-essential \
cdbs \
curl \
devscripts \
equivs \
fakeroot \
less \
libdistro-info-perl \
libmicrohttpd-dev \
libpython3-dev \
lsof \
net-tools \
ninja-build \
libgmp-dev \
libprotobuf-dev \
libgrpc++-dev \
libgrpc++1 \
protobuf-compiler \
protobuf-compiler-grpc \
pkg-config \
screen \
socat \
tree
apt install -y --no-install-recommends \
python3-pip \
python3-setuptools
pip3 install \
grpcio-tools \
meson \
poetry \
yq
EOT
ARG SN_HW_GROUP
ARG SN_HW_REPO
ARG SN_HW_BRANCH
ARG SN_HW_BOARD
ARG SN_HW_APP_NAME
ARG SN_HW_VER
ARG SN_HW_COMMIT
ARG SN_FW_GROUP
ARG SN_FW_REPO
ARG SN_FW_BRANCH
ARG SN_FW_APP_NAME
ARG SN_FW_VER
ARG SN_FW_COMMIT
ENV SN_HW_GROUP=${SN_HW_GROUP}
ENV SN_HW_REPO=${SN_HW_REPO}
ENV SN_HW_BRANCH=${SN_HW_BRANCH}
ENV SN_HW_BOARD=${SN_HW_BOARD}
ENV SN_HW_APP_NAME=${SN_HW_APP_NAME}
ENV SN_HW_VER=${SN_HW_VER}
ENV SN_HW_COMMIT=${SN_HW_COMMIT}
ENV SN_FW_GROUP=${SN_FW_GROUP}
ENV SN_FW_REPO=${SN_FW_REPO}
ENV SN_FW_BRANCH=${SN_FW_BRANCH}
ENV SN_FW_APP_NAME=${SN_FW_APP_NAME}
ENV SN_FW_VER=${SN_FW_VER}
ENV SN_FW_COMMIT=${SN_FW_COMMIT}
COPY . /sn-fw/source
WORKDIR /sn-fw/source
# Build and install the Python regmap library.
RUN <<EOF
set -ex
cd regio
poetry build
pip3 install --find-links ./dist regio[shells]
EOF
RUN --mount=type=cache,target=/sn-fw/source/subprojects/packagecache <<EOF
set -ex
meson subprojects purge --confirm
ln -fs \
${PWD}/sn-hw/artifacts.${SN_HW_BOARD}.${SN_HW_APP_NAME}.${SN_HW_VER}.zip \
subprojects/packagefiles/esnet-smartnic-hwapi.zip
meson subprojects download
meson setup /sn-fw/build /sn-fw/source
meson compile --clean -C /sn-fw/build
meson install -C /sn-fw/build
ldconfig
# Install the generated Python regmap and configuration client.
pip3 install \
--find-links /usr/local/share/esnet-smartnic/python \
regmap_esnet_smartnic \
sn_cfg \
sn_p4
# Install bash completions.
regio-esnet-smartnic -t zero -p none completions bash >/usr/share/bash-completion/completions/regio-esnet-smartnic
sn-cfg completions bash >/usr/share/bash-completion/completions/sn-cfg
sn-p4 completions bash >/usr/share/bash-completion/completions/sn-p4
cat <<'_EOF' >>/root/.bashrc
# Enable bash completion for non-login interactive shells.
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
_EOF
EOF
COPY <<EOF /sn-fw/buildinfo.env
SN_FW_GROUP=${SN_FW_GROUP}
SN_FW_REPO=${SN_FW_REPO}
SN_FW_BRANCH=${SN_FW_BRANCH}
SN_FW_APP_NAME=${SN_FW_APP_NAME}
SN_FW_VER=${SN_FW_VER}
SN_FW_COMMIT=${SN_FW_COMMIT}
SN_HW_GROUP=${SN_HW_GROUP}
SN_HW_REPO=${SN_HW_REPO}
SN_HW_BRANCH=${SN_HW_BRANCH}
SN_HW_BOARD=${SN_HW_BOARD}
SN_HW_APP_NAME=${SN_HW_APP_NAME}
SN_HW_VER=${SN_HW_VER}
SN_HW_COMMIT=${SN_HW_COMMIT}
EOF
# Setup the test automation framework.
WORKDIR sn-stack/test
RUN <<EOF
set -ex
mkdir /test
cp entrypoint.sh /test/.
# Install Python dependencies for the test automation libraries.
for req in $(find . -type f -name pip-requirements.txt); do
pip3 install --no-deps --requirement="${req}"
done
EOF
# Install the MinIO client command line tool.
ADD \
--chmod=755 \
https://dl.min.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2024-11-21T17-21-54Z \
/usr/local/bin/mc
WORKDIR /
CMD ["/bin/bash"]