Skip to content

Commit

Permalink
Remove temporary files and import dash_api to python3 env (sonic-net#…
Browse files Browse the repository at this point in the history
…16033)

1. Remove useless temporary protobuf deb packages
2. Import dash_api to python3 env

### Why I did it
1. There are some temporary Debian packages,protobuf packages, needs to be deleted
2. The dash-api was installed in the system folder that cannot be imported by the virtual python3 environment. But the testcases of DASH in sonic-mgmt are executed in virtual python3 environment.

##### Work item tracking
- Microsoft ADO **(number only)**: 17417902

#### How I did it
1. Add missed `&&` so that all protobuf debian packaged can be downloaded to the /tmp folder
2. Add ` --system-site-packages ` to env-python so that the system library can be accessed by virtual environment

#### How to verify it
Check the dash_api can be imported in env-python3
```
AzDevOps@46a900cf8477:~$ source env-python3/bin/activate
(env-python3) zegan@46a900cf8477:~$ ls
bin  env-python3
(env-python3) zegan@46a900cf8477:~$ python3
Python 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dash_api
>>>

```
  • Loading branch information
Pterosaur authored Aug 9, 2023
1 parent 8524e56 commit 96757a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dockers/docker-sonic-mgmt/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ debs/{{ deb }}{{' '}}

# Install protobuf 3.21.12
RUN mkdir -p /tmp/protobuf \
cd /tmp/protobuf \
&& cd /tmp/protobuf \
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-dev_3.21.12-3_amd64.deb \
&& 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 \
Expand Down Expand Up @@ -263,7 +263,7 @@ WORKDIR /var/$user
# Add az symlink for backwards compatibility
RUN mkdir bin && ln -s /usr/bin/az bin/az

RUN python3 -m venv env-python3
RUN python3 -m venv --system-site-packages env-python3

# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD.
ENV VIRTUAL_ENV=env-python3
Expand Down

0 comments on commit 96757a3

Please sign in to comment.