-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build p4c from custom fork #249
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,9 @@ DOCKER_SAITHRIFT_BLDR_IMG ?=chrissommers/dash-saithrift-bldr:220819 | |
# Base image with test frameworks, DASH client libs not installed | ||
DOCKER_SAITHRIFT_CLIENT_BLDR_IMG ?=chrissommers/dash-saithrift-client-bldr:220819 | ||
|
||
# P4c builder - p4c build dependencies, custom p4c fork | ||
DOCKER_P4C_BLDR_IMG ?=chrissommers/dash-p4c-bldr:221007 | ||
|
||
# Client image built locally with saithrift client libs + PTF & Pytest frameworks | ||
# TODO: consider some other tagging scheme | ||
DOCKER_SAITHRIFT_CLIENT_IMG ?= local/dash-saithrift-client:latest | ||
|
@@ -412,6 +415,19 @@ run-saithrift-client-bash: | |
# --build-arg available_processors=$(shell nproc) \ | ||
# dockerfiles | ||
|
||
# Builder, has base packages to make client docker | ||
docker-dash-p4c-bldr: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You also need to make target docker-pull-dash-p4c-bldr which will be called in CI scripts. (We |
||
docker build \ | ||
-f dockerfiles/Dockerfile.p4c-bldr \ | ||
-t $(DOCKER_P4C_BLDR_IMG) \ | ||
--build-arg user=$(DASH_USER) \ | ||
--build-arg group=$(DASH_GROUP) \ | ||
--build-arg uid=$(DASH_UID) \ | ||
--build-arg guid=$(DASH_GUID) \ | ||
--build-arg hostname=$(DASH_HOST) \ | ||
--build-arg available_processors=$(shell nproc) \ | ||
./tests | ||
|
||
docker-dash-p4c: | ||
docker build \ | ||
-f dockerfiles/Dockerfile.p4c-bmv2 \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# It uses grpc 1.43.2 as base to ensure right lib versions. | ||
FROM chrissommers/dash-grpc:1.43.2 as grpc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use sonicdash.azurecr.io/dash-grpc:1.43.2 |
||
|
||
# https://hub.docker.com/r/p4lang/behavioral-model | ||
FROM p4lang/behavioral-model:no-pi | ||
LABEL maintainer="SONIC-DASH Community" | ||
LABEL description="DASH pipeline P4 Behavioral Model and toolchain" | ||
|
||
# Configure make to run as many parallel jobs as cores available | ||
ARG available_processors | ||
ARG MAKEFLAGS=-j$available_processors | ||
|
||
|
||
# Select the compiler to use. | ||
# We install the default version of GCC (GCC 9), as well as clang 8 and clang 10. | ||
ARG sswitch_grpc=yes | ||
ARG CC=gcc | ||
ARG CXX=g++ | ||
ENV TZ=America/Los_Angeles | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
ENV GIT_SSL_NO_VERIFY=true | ||
|
||
ENV PI_DEPS automake \ | ||
build-essential \ | ||
clang-8 \ | ||
clang-10 \ | ||
clang-format-8 \ | ||
g++ \ | ||
libboost-dev \ | ||
libboost-system-dev \ | ||
libboost-thread-dev \ | ||
libtool \ | ||
libtool-bin \ | ||
pkg-config \ | ||
libreadline-dev \ | ||
libpcap-dev \ | ||
libmicrohttpd-dev \ | ||
doxygen \ | ||
valgrind \ | ||
vim \ | ||
git-core \ | ||
python3 \ | ||
cmake \ | ||
python3-pip | ||
|
||
ENV PI_RUNTIME_DEPS libboost-system1.71.0 \ | ||
libboost-thread1.71.0 \ | ||
libpcap0.8 \ | ||
python3 \ | ||
python-is-python3 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends $PI_DEPS $PI_RUNTIME_DEPS | ||
|
||
COPY --from=grpc /usr/local/lib/lib*grpc*.so* \ | ||
/usr/local/lib/libabsl*.so* \ | ||
/usr/local/lib/libgpr*.so* \ | ||
/usr/local/lib/libupb*.so* \ | ||
/usr/local/lib/libre2*.so* \ | ||
/usr/local/lib/libaddress_sorting*.so* \ | ||
/usr/local/lib/libssl*.so* \ | ||
/usr/local/lib/libcrypto*.so* \ | ||
./ | ||
|
||
ENV LD_LIBRARY_PATH=/usr/local/lib | ||
|
||
RUN apt-get install -y cmake g++ git automake libtool libgc-dev bison flex \ | ||
libfl-dev libgmp-dev libboost-dev libboost-iostreams-dev \ | ||
libboost-graph-dev llvm pkg-config python3 python3-pip \ | ||
tcpdump | ||
|
||
RUN pip3 install ipaddr scapy ply | ||
|
||
WORKDIR / | ||
|
||
RUN git clone https://github.com/p4lang/PI | ||
WORKDIR /PI/ | ||
RUN git submodule update --init --recursive | ||
RUN apt-get update && \ | ||
./autogen.sh && \ | ||
./configure --enable-Werror --with-bmv2 --with-proto --with-cli --with-internal-rpc --with-sysrepo && \ | ||
./proto/sysrepo/install_yangs.sh && \ | ||
make && \ | ||
make install | ||
|
||
WORKDIR / | ||
|
||
RUN pip install jinja2 | ||
|
||
RUN git clone --recursive https://github.com/marian-pritsak/p4c.git | ||
|
||
RUN cd p4c && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake .. && \ | ||
make -j4 && \ | ||
make install | ||
|
||
ARG user | ||
ARG uid | ||
ARG guid | ||
ARG hostname | ||
|
||
ENV BUILD_HOSTNAME $hostname | ||
ENV USER $user | ||
|
||
RUN groupadd -f -r -g $guid g$user | ||
|
||
RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash | ||
|
||
RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers | ||
|
||
USER $user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, following #225 docker images are defined in
.env
files underdockerfiles/
and areincluded
into theMakefile
. You should sync to main, thanks.