Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

Docker build for azure-cli image fails on x86 #30126

Open prachi-gaonkar opened 1 month ago

prachi-gaonkar commented 1 month ago

Describe the bug

Hi team

we are trying to build this docker file https://github.com.mcas.ms/Azure/azure-cli/blob/azure-cli-2.65.0/scripts/release/debian/Dockerfile

but we are facing issues during build. We did below changes but still it gives errors.

1) to resolve error at 'pip install wheel ' changed base image to ubuntu:22.04 2) removed '&&' at line 31 to resolve syntax error. 3) the build is failing at command "dpkg-buildpackage -us -uc" with below error dpkg-shlibdeps: error: cannot read debian/azure-cli/opt/az/lib/python3./lib-dynload/_ssl.cpython-3-*-linux-gnu.so: No such file or directory make[1]: Leaving directory '/azure-cli' make[1]: [debian/rules:21: override_dh_install] Error 2 make: [debian/rules:8: binary] Error 2 dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

fyi we could locate same file at below 3 locations: RUN find / -name "_ssl.cpython-3--linux-gnu.so" 14.0s => => # /usr/lib/python3.10/lib-dynload/_ssl.cpython-310-x86_64-linux-gnu.so => => # /azure-cli/python_env/lib/python3.10/lib-dynload/_ssl.cpython-310-x86_64-linux-gnu.so => => # /azure-cli/build/lib.linux-x86_64-3.10/_ssl.cpython-310-x86_64-linux-gnu.so

4) We have tried copying the above file to desired location but it fails with same error. Command to copy file: RUN mkdir -p debian/azure-cli/opt/az/lib/python3./lib-dynload/ RUN cp /usr/lib/python3.10/lib-dynload/_ssl.cpython-310-x86_64-linux-gnu.so debian/azure-cli/opt/az/lib/python3./lib- dynload/

please let us know what can be done here

Related command

Command used to build docker image. docker build --target build-env -f ./scripts/release/debian/Dockerfile -t azure/azure-cli:ubuntu-builder .

Errors

Error: dpkg-shlibdeps: error: cannot read debian/azure-cli/opt/az/lib/python3./lib-dynload/_ssl.cpython-3--linux-gnu.so: No such file or directory . dpkg-shlibdeps: debug: Using symbols file /var/lib/dpkg/info/libc6:amd64.symbols for libm.so.6 . dpkg-shlibdeps: debug: Using symbols file /var/lib/dpkg/info/libc6:amd64.symbols for libc.so.6 . dpkg-shlibdeps: debug: >> Scanning debian/azure-cli/opt/az/lib/python3./lib-dynload/_ssl.cpython-3--linux-gnu.so (for Depends field) . make[1]: [debian/rules:21: override_dh_install] Error 2 . make[1]: Leaving directory '/azure-cli' . make: [debian/rules:8: binary] Error 2 . dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2

Issue script & Debug output

As mentioned above

Expected behavior

Image should build successfully https://github.com.mcas.ms/Azure/azure-cli/blob/azure-cli-2.65.0/scripts/release/debian/Dockerfile

Environment Summary

OS: ubuntu 22.04

Additional context

No response

yonzhan commented 1 month ago

Thank you for opening this issue, we will look into it.

github-actions[bot] commented 1 month ago

Here are some similar issues that might help you. Please check if they can solve your problem.

bebound commented 1 month ago

This dockerfile is outdated. Please use ubuntu:22.04 as base image and use one-line script to install azure-cli: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?branch=live&pivots=apt#option-1-install-with-one-command

prachi-gaonkar commented 1 month ago

We have used base image as ubuntu:22.04 but it still gives error during build for below Docker file. https://github.com.mcas.ms/Azure/azure-cli/blob/azure-cli-2.65.0/scripts/release/debian/Dockerfile

We wanted to know which Dockerfile from repository should we refer to build the image mcr.microsoft.com/azure-cli:latest

bebound commented 1 month ago

https://github.com/Azure/azure-cli/blob/dev/azure-linux.dockerfile