Editor Lite image
- Dominant language
- Dockerfile
- Stars
- 470
- Forks
- 140
- PR merge metrics
- No merged PRs in 30d
Description
**Description**
Some time ago I've started to investigate can the image be smaller. I've managed to reduce image size three times (from 3 GB to 1 GB). The reasoning behind my research was that the private GitHub repo has a limited amount of action execution minutes. And seems like downloading the docker image is a significant part of the run tests action. By decreasing the size of the image, we reduced the time of the unity-test-runner from 5.0 mins to 2.3 mins.


But since I'm not interested in fighting around pull requests to this repo and do not have time to test all the limitations & edge cases I want just to share with you the dockerfile to let the community decide is it feasible to take some of my findings and cut them out from the official image.
Dockerfile:
```
ARG baseImage=unityci/base:latest
ARG editorImage=unityci/editor:2020.2.1f1-base-0
FROM $editorImage as builder
# Templates
RUN echo 'Cleaning image' \
# Remove templates
&& rm -rf /opt/unity/Editor/Data/Resources/PackageManager/ProjectTemplates/ \
&& rm -rf /opt/unity/Editor/Data/Resources/PackageManager/PackageTemplates/ \
# Remove everything except manifest from packages
&& find /opt/unity/Editor/Data/Resources/PackageManager/Editor/ \
! -name 'manifest.json' \
-type f -exec rm -f {} + \
# Remove unnecessary Mono resources
&& rm -rf /opt/unity/Editor/Data/MonoBleedingEdge/lib/mono/monodoc/ \
&& rm -rf /opt/unity/Editor/Data/MonoBleedingEdge/bin-linux32 \
# SDK is not required for .NET Core
&& rm -rf /opt/unity/Editor/Data/NetCore/Sdk-* \
# We are not planning to debug in CI
&& rm -rf /opt/unity/Editor/Unity_s.debug \
# Remove playback engines
&& rm -rf /opt/unity/Editor/Data/PlaybackEngines/
###########################
# Editor #
###########################
FROM $baseImage
# Always put "Editor" and "modules.json" directly in $UNITY_PATH
ARG UNITY_PATH=/opt/unity
COPY --from=builder "$UNITY_PATH/" "$UNITY_PATH/"
# Alias to "unity-editor" with default params
RUN echo '#!/bin/bash\nxvfb-run -ae /dev/stdout "$UNITY_PATH/Editor/Unity" -batchmode "$@"' > /usr/bin/unity-editor \
&& chmod +x /usr/bin/unity-editor
```
Contributor guide
Assessment
This issue has not been assessed yet.