game-ci / docker

Series of CI-specialised docker images for Unity.
https://hub.docker.com/u/unityci
MIT License
400 stars 124 forks source link

deps: upgrade libstdc++ to support Autodesk FBX SDK for Unity #163

Closed jsm174 closed 2 years ago

jsm174 commented 2 years ago

Changes

com.autodesk.fbx@4.1 requires libstdc++ 6.0.28+ (see https://docs.unity3d.com/Packages/com.autodesk.fbx@4.1/manual/index.html)

Unfortunately the version of libstdc++ that comes with Ubuntu 18 is 6.0.25. Until the base images are updated to use Ubuntu 20 (which has a much newer version), we need to install an update libstdc++.

I was able to make a docker image:

FROM unityci/editor:2021.2.15f1-linux-il2cpp-0
RUN apt-get update && apt-get -y install software-properties-common && add-apt-repository -y ppa:ubuntu-toolchain-r/test && apt-get -y install --only-upgrade libstdc++6

This was tested at:

https://github.com/freezy/VisualPinball.Engine/pull/387#issuecomment-1066182772

Checklist

github-actions[bot] commented 2 years ago

Cat Gif

webbertakken commented 2 years ago

We usually only add target-platform-specific additions to editor image. These changes should be made in the base image instead (images/ubuntu/base/Dockerfile).

Could you please give an indication of how much space is used by the base image before and after?

jsm174 commented 2 years ago

We usually only add target-platform-specific additions to editor image. These changes should be made in the base image instead (images/ubuntu/base/Dockerfile).

Could you please give an indication of how much space is used by the base image before and after?

Thanks. I was going to do base and then I wasn't sure. Reverted the change, and updated accordingly.

As for size, it looks like it's 24mb.

docker images -a unityci/base:ubuntu-latest
REPOSITORY     TAG             IMAGE ID       CREATED       SIZE
unityci/base   ubuntu-latest   841ddfea6757   2 weeks ago   474MB

docker images -a jsm174/unityci_base:ubuntu-latest
REPOSITORY            TAG             IMAGE ID       CREATED         SIZE
jsm174/unityci_base   ubuntu-latest   2b196435d7a1   9 minutes ago   498MB

I feel like more could be cleaned up, but I must be missing something. I added software-properties-common just to get add-apt-repository and then I remove it after installation.

After using dive, it seems like most of the size is in the /var/cache/lib/apt/lists directory:

Screen Shot 2022-03-14 at 8 40 34 AM
jsm174 commented 2 years ago

@webbertakken - I was looking at the editor docker file, and noticed all

apt-get clean are followed by rm -rf /var/lib/apt/lists/*

If we do that here,

docker images -a jsm174/unityci_base:ubuntu-latest
REPOSITORY            TAG             IMAGE ID       CREATED         SIZE
jsm174/unityci_base   ubuntu-latest   c1e5176d1603   6 seconds ago   479MB

The change is ~4MB. We could that for the first block as well and reduce the size of the image as well?

jsm174 commented 2 years ago
Screen Shot 2022-03-14 at 8 59 35 AM
jsm174 commented 2 years ago

Could you please give an indication of how much space is used by the base image before and after?

474MB before, 396MB after. 78MB reduction

webbertakken commented 2 years ago

Could you please give an indication of how much space is used by the base image before and after?

474MB before, 396MB after. 78MB reduction

It's a bit unclear to me how much the size is affected by each change, with both changes in the same MR. Would you mind applying the suggestion your suggestion in a separate PR:

apt-get clean are followed by rm -rf /var/lib/apt/lists/*

If you could make a screenshot both before and after of the total size of the base image it will be easier to compare (per layer stats aren't very useful).

Then we can rebase this PR and again see the difference of total image size before and after.

jsm174 commented 2 years ago

Sure. Ahh, you were right, only a decrease of about 27mb.

Screen Shot 2022-03-17 at 3 08 57 PM
webbertakken commented 2 years ago

Context

Tried the changes locally to make a more exact comparison of base image.

Proof

image

Conclusion

Upgrading the lib in this MR increases size by 4 megs, which is acceptable, as it allows (experimental) unity packages to work out of the box.