Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions dockers/docker-sonic-mgmt/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,27 @@ RUN dpkg -i \
debs/{{ deb }}{{' '}}
{%- endfor %}

# Install protobuf 3.21.12
RUN mkdir -p /tmp/protobuf \
cd /tmp/protobuf \
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-dev_3.21.12-3_amd64.deb \
Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

20.04

It is also used in FROM in the beginning of the file. Will dpkg fail if we upgrade the FROM line to new version? #Pending

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These packets are compiled in ubuntu20.04. Actually, a better method is to install these packets from bullseye slave by sonic_mgmt_debs variable, but due to bullseye and ubuntu dependencies issues, like python 3.8 and python 3.9, we have to install a pre-compiled version.
If we upgrade this docker to a new version, like ubuntu22.04, we can follow the typical method to build this docker.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider 20.04 as a named constant.

&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-lite32_3.21.12-3_amd64.deb \
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf32_3.21.12-3_amd64.deb \
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotoc-dev_3.21.12-3_amd64.deb \
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotoc32_3.21.12-3_amd64.deb \
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/protobuf-compiler_3.21.12-3_amd64.deb \
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/python3-protobuf_3.21.12-3_amd64.deb \
&& dpkg -i *.deb \
&& rm -rf /tmp/protobuf

# Install dash-api
RUN cd /tmp \
&& mkdir -p /usr/lib/python3/dist-packages/dash_api \
&& wget https://raw.githubusercontent.com/sonic-net/sonic-buildimage/master/src/sonic-dash-api/pypkg/__init__.py -O /usr/lib/python3/dist-packages/dash_api/__init__.py \
Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init.py

This file is inside the same repo, why wget? #Pending

&& git clone https://github.com/sonic-net/sonic-dash-api.git \
Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sonic-dash-api.git

This repo is a submodule, it should be available in the working directory. #Pending

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is within the docker, not available.

Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to worry if this code on a release branch, but it actually wget/git clone some master files? For example, when branch out 202311, this dockerfile will pull master code.

Copy link
Copy Markdown
Contributor Author

@Pterosaur Pterosaur Jul 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. If we want to access the files in src, we have to mount the src folder to Docker build workspace. But the files in src may be too many(More than 30GB) for Docker daemon which will dramatically downgrade the performance of Docker daemon.
  2. After the sonic-mgmt upgrade to 20.04, I believe we can follow the typical method, docker_mgmt_debs, to install them.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explore # 1: you do not need to mount src folder, just copy what you need to Docker build workspace.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under the current framework, I didn't find a script to do that.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a issue #15848. And ask for solving in future PR.

&& protoc -I=sonic-dash-api/proto --python_out=/usr/lib/python3/dist-packages/dash_api sonic-dash-api/proto/*.proto \
&& rm -rf /tmp/sonic-dash-api

RUN mkdir /var/run/sshd
EXPOSE 22

Expand Down
2 changes: 1 addition & 1 deletion rules/sonic-dash-api.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LIB_SONIC_DASH_API = libdashapi_$(LIB_SONIC_DASH_API_VERSION)_$(CONFIGURED_ARCH)
$(LIB_SONIC_DASH_API)_SRC_PATH = $(SRC_PATH)/sonic-dash-api

$(LIB_SONIC_DASH_API)_DEPENDS += $(PROTOBUF) $(PROTOBUF_LITE) $(PROTOBUF_DEV) $(PROTOBUF_COMPILER)
$(LIB_SONIC_DASH_API)_RDEPENDS += $(LIBSWSSCOMMON) $(LIBNL3) $(LIBNL_GENL3) $(LIBNL_ROUTE3) $(PROTOBUF) $(PROTOBUF_LITE)
$(LIB_SONIC_DASH_API)_RDEPENDS += $(PROTOBUF) $(PROTOBUF_LITE) $(PYTHON3_PROTOBUF)

SONIC_DPKG_DEBS += $(LIB_SONIC_DASH_API)

Expand Down
2 changes: 1 addition & 1 deletion slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1560,4 +1560,4 @@ jessie : $$(addprefix $(TARGET_PATH)/,$$(JESSIE_DOCKER_IMAGES)) \

## To build some commonly used libs. Some submodules depend on these libs.
## It is used in component pipelines. For example: swss needs libnl, libyang
lib-packages: $(addprefix $(DEBS_PATH)/,$(LIBNL3) $(LIBYANG))
lib-packages: $(addprefix $(DEBS_PATH)/,$(LIBNL3) $(LIBYANG) $(PROTOBUF) $(LIB_SONIC_DASH_API))