I was able to workaround this issue.

I had to tell docker to build the container to the desired architecture 
with:

*docker buildx build -t {CONTAINER_TAG_NAME} --platform linux/amd64*

On Thursday, August 12, 2021 at 10:02:37 AM UTC+1 David Lopes wrote:

> I guess that's possible, but I don't think I am. I'm using the exact same 
> build script to build in multiple platforms and the results are very 
> different. Just now, I ran the build script from my apple M1 laptop 
> *directly* (instead of running inside a docker container) and the file 
> goes down to a standard size (check print).
>
> [image: Screenshot 2021-08-12 at 09.52.53.png]
>
> To summarize, these are the different build variations I did so far:
>
>    1. windows laptop: OK
>    2. macOS M1 chip: OK
>    3. docker container on top of Windows: OK
>    4. docker on top of macOS M1 chip: NOT OK
>
> The build script is basically doing the following:
>
>    - pip install -r *<requirements.txt>* -t *<dependencies_folder>*
>    - zip -r *<dependencies_zip_file>* *<dependencies_folder>*
>    
> The prints I'm sharing are the content of the *<dependencies_folder>*
>
> This suggests that my docker installation on macOS is doing something 
> weird, but I can't figure it out.
> On Thursday, August 12, 2021 at 3:42:21 AM UTC+1 Craig Tiller wrote:
>
>> Are you inadvertently turning on something that records debug symbols?
>>
>> On Wed, Aug 11, 2021 at 7:31 PM David Lopes <[email protected]> 
>> wrote:
>>
>>> Hello all,
>>>
>>> I have a set of build scripts that spawn a docker container to build a 
>>> set of artifacts in Python using PIP. One of the dependencies of these 
>>> artifacts is, of course, the *grpc* library. The build script is 
>>> basically pip installing a *requirements.txt* and zipping the 
>>> dependencies.
>>>
>>> I noticed the following odd behavior:
>>>
>>> When I run the scripts from my Windows laptop, 
>>> *cygrpc.cpython-38-x86_64-linux-gnu.so 
>>> <http://cygrpc.cpython-38-x86_64-linux-gnu.so>* file has 9.8M in size. 
>>> However, if I run the exact same scripts from an Apple M1 laptop, 
>>> *cygrpc.cpython-38-aarch64-linux-gnu.so 
>>> <http://cygrpc.cpython-38-aarch64-linux-gnu.so>* will take an 
>>> astonishing 119M in size (check prints below)
>>>
>>> [image: Screenshot 2021-08-12 at 00.18.49.png]
>>>
>>> [image: image.png]
>>>
>>> This is problematic, as these scripts are building an AWS Lambda layer, 
>>> and having a single .so with 119M is a big no-no.
>>>
>>> Do you have any idea why is this happening? How can I possibly build my 
>>> package without having to carry a 119M file around?
>>>
>>> Thanks,
>>> David
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "grpc.io" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/grpc-io/316dc65f-51a3-45f2-b4d1-6df2c7fadf15n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/grpc-io/316dc65f-51a3-45f2-b4d1-6df2c7fadf15n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/3479e4cf-1856-430b-b673-9903f90a45aen%40googlegroups.com.

Reply via email to