[GH-ISSUE #196] Slim variant of nektos/act-environments-ubuntu:18.04 #133

Closed
opened 2026-03-01 21:40:32 +03:00 by kerem · 9 comments
Owner

Originally created by @aidansteele on GitHub (Apr 17, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/196

My feeling reading some of the issues in this repo is that a lot of folks get stuck on the fact that we default to not using the enormous image - which is a reasonable IMHO. I've been thinking about whether there's a compromise we can reach, where we get e.g. 90% of the benefit at 30% of the size.

There would be pros and cons to this approach. Pros would likely be fewer issues on this repo, an easier getting-started process for most people, etc. Cons would be that the environment would be so close to the Github-provided one, but crucially not identical - which would cause a lot of head-scratching. Disregarding this for now, I started to take a cursory look at how we might want to shrink the image size.

All these numbers are on the uncompressed (~18GB total) image size:

  • At least 4GB is used by the Boost C++ library. This is spread across two versions of the library. At the very least, we could consider deleting the older one. Maybe both?
  • 1.5GB is used by the NPM cache. Amusingly, quite a bit (most) of this is gzipped tars of the above Boost libraries. This seems like an ideal candidate for purging, given it would also remove 1.5GB from the image download size
  • ~1.5GB of Python distributions spread between /opt/hostedtoolcache and Miniconda in addition to the Python that comes with Ubuntu
  • 1.2GB on four different JVMs
  • ~1GB spread over multiple Azure CLIs
  • 1GB on Rust
  • ~700MB of older Golang versions

What are your thoughts on this selective purge? I'm thinking that we'd likely want to automate the creation of the image + purging as well. If you're happy with the idea in general, I'll start experimenting with some approaches.

Originally created by @aidansteele on GitHub (Apr 17, 2020). Original GitHub issue: https://github.com/nektos/act/issues/196 My feeling reading some of the issues in this repo is that a lot of folks get stuck on the fact that we default to not using the enormous image - which is a reasonable IMHO. I've been thinking about whether there's a compromise we can reach, where we get e.g. 90% of the benefit at 30% of the size. There would be pros and cons to this approach. Pros would likely be fewer issues on this repo, an easier getting-started process for most people, etc. Cons would be that the environment would be _so close_ to the Github-provided one, but crucially _not_ identical - which would cause a lot of head-scratching. Disregarding this for now, I started to take a cursory look at how we might want to shrink the image size. All these numbers are on the uncompressed (~18GB total) image size: * At least 4GB is used by the Boost C++ library. This is spread across two versions of the library. At the very least, we could consider deleting the older one. Maybe both? * 1.5GB is used by the NPM cache. Amusingly, quite a bit (most) of this is gzipped tars of the above Boost libraries. **This seems like an ideal candidate for purging, given it would also remove 1.5GB from the image download size** * ~1.5GB of Python distributions spread between /opt/hostedtoolcache and Miniconda *in addition to the Python that comes with Ubuntu* * 1.2GB on four different JVMs * ~1GB spread over multiple Azure CLIs * 1GB on Rust * ~700MB of older Golang versions What are your thoughts on this selective purge? I'm thinking that we'd likely want to automate the creation of the image + purging as well. If you're happy with the idea in general, I'll start experimenting with some approaches.
kerem 2026-03-01 21:40:32 +03:00
Author
Owner

@cplee commented on GitHub (Apr 17, 2020):

@aidansteele I'm totally onboard with this idea 🚀

<!-- gh-comment-id:615047072 --> @cplee commented on GitHub (Apr 17, 2020): @aidansteele I'm totally onboard with this idea 🚀
Author
Owner

@cplee commented on GitHub (Apr 17, 2020):

btw - here's the repo for the image i built: https://github.com/nektos/act-environments

<!-- gh-comment-id:615047268 --> @cplee commented on GitHub (Apr 17, 2020): btw - here's the repo for the image i built: https://github.com/nektos/act-environments
Author
Owner

@aidansteele commented on GitHub (Apr 17, 2020):

Great, good to hear you think it's a reasonable idea. I'll try report back with my findings / PR in the next few days - week.

<!-- gh-comment-id:615049084 --> @aidansteele commented on GitHub (Apr 17, 2020): Great, good to hear you think it's a reasonable idea. I'll try report back with my findings / PR in the next few days - week.
Author
Owner

@phaze9 commented on GitHub (Apr 17, 2020):

I took the opposite approach by starting with act's default node:12.6-buster-slim image and adding what I need, which is currently docker.

If you're interested in creating a slim image tailored to your use-case, feel free to fork https://github.com/phaze9/action-runner
Or grab the slim image including docker-ce from https://hub.docker.com/repository/docker/phaze9/action-runner

<!-- gh-comment-id:615067299 --> @phaze9 commented on GitHub (Apr 17, 2020): I took the opposite approach by starting with act's default node:12.6-buster-slim image and adding what I need, which is currently docker. If you're interested in creating a slim image tailored to your use-case, feel free to fork https://github.com/phaze9/action-runner Or grab the slim image including docker-ce from https://hub.docker.com/repository/docker/phaze9/action-runner
Author
Owner

@aidansteele commented on GitHub (Apr 27, 2020):

I got a chance today to start looking into this. I created a tool to convert the upstream ubuntu1804.json into a Dockerfile (I'll release that later) and attempted to build it. A few things:

The total size is now just under 50 GB 🤯

It looks like some new things have been added to the environment since @cplee's image was built.

There are some steps I skipped as they failed and I didn't have time to look into why yet. The skipped steps were:

  • scripts/installers/docker-moby.sh (test failed due to dockerd not running inside container)
  • scripts/helpers/containercache.sh (same as above)
  • scripts/installers/homebrew.sh (refused to be installed as root)
  • scripts/installers/aws-sam-cli.sh (uses homebrew)
  • scripts/installers/mysql.sh (test failed to mysqld not running inside container)
  • scripts/installers/1804/android.sh
  • scripts/installers/vcpkg.sh
  • scripts/installers/1804/php.sh

These were all the steps that resulted in a layer on disk greater than 50 MB.

SIZE CREATED BY
20.4 GB scripts/installers/dotnetcore-sdk.sh
9.3 GB scripts/installers/haskell.sh
7.14 GB scripts/installers/hosted-tool-cache.sh
1.6 GB scripts/installers/swift.sh
1.37 GB scripts/installers/java-tools.sh
1.37 GB scripts/installers/clang.sh
921 MB scripts/installers/azpowershell.sh
527 MB scripts/installers/mono.sh
503 MB scripts/installers/rust.sh
500 MB scripts/installers/azure-cli.sh
382 MB scripts/installers/miniconda.sh
367 MB scripts/installers/nodejs.sh
366 MB scripts/installers/julia.sh
364 MB scripts/installers/google-cloud-sdk.sh
302 MB scripts/installers/mongodb.sh
287 MB scripts/installers/hhvm.sh
271 MB scripts/installers/bazel.sh
260 MB scripts/installers/google-chrome.sh
203 MB scripts/installers/1804/basic.sh
202 MB scripts/installers/1804/basic.sh
190 MB scripts/installers/1804/containers.sh
164 MB scripts/installers/powershellcore.sh
162 MB scripts/installers/powershellcore.sh
155 MB scripts/installers/packer.sh
155 MB scripts/installers/azcopy.sh
130 MB scripts/installers/python.sh
128 MB scripts/installers/ansible.sh
110 MB scripts/installers/cmake.sh
103 MB scripts/installers/heroku.sh
96 MB scripts/installers/phantomjs.sh
89 MB scripts/installers/1804/kubernetes-tools.sh
75.5 MB scripts/installers/aws.sh
68.4 MB apt-get -y install sudo lsb-core software-properties-common apt-utils
67.3 MB scripts/installers/ruby.sh
53.1 MB scripts/installers/git.sh
52.1 MB scripts/installers/terraform.sh
<!-- gh-comment-id:619735743 --> @aidansteele commented on GitHub (Apr 27, 2020): I got a chance today to start looking into this. I created a tool to convert the upstream `ubuntu1804.json` into a Dockerfile (I'll release that later) and attempted to build it. A few things: The total size is now just under 50 GB 🤯 It looks like some new things have been added to the environment since @cplee's image was built. There are some steps I skipped as they failed and I didn't have time to look into why yet. The skipped steps were: * `scripts/installers/docker-moby.sh` (test failed due to dockerd not running inside container) * `scripts/helpers/containercache.sh` (same as above) * `scripts/installers/homebrew.sh` (refused to be installed as root) * `scripts/installers/aws-sam-cli.sh` (uses homebrew) * `scripts/installers/mysql.sh` (test failed to mysqld not running inside container) * `scripts/installers/1804/android.sh` * `scripts/installers/vcpkg.sh` * `scripts/installers/1804/php.sh` These were all the steps that resulted in a layer on disk greater than 50 MB. | **SIZE** | **CREATED BY** | | -------- | ------------------------------------------------------------ | | 20.4 GB | scripts/installers/dotnetcore-sdk.sh | | 9.3 GB | scripts/installers/haskell.sh | | 7.14 GB | scripts/installers/hosted-tool-cache.sh | | 1.6 GB | scripts/installers/swift.sh | | 1.37 GB | scripts/installers/java-tools.sh | | 1.37 GB | scripts/installers/clang.sh | | 921 MB | scripts/installers/azpowershell.sh | | 527 MB | scripts/installers/mono.sh | | 503 MB | scripts/installers/rust.sh | | 500 MB | scripts/installers/azure-cli.sh | | 382 MB | scripts/installers/miniconda.sh | | 367 MB | scripts/installers/nodejs.sh | | 366 MB | scripts/installers/julia.sh | | 364 MB | scripts/installers/google-cloud-sdk.sh | | 302 MB | scripts/installers/mongodb.sh | | 287 MB | scripts/installers/hhvm.sh | | 271 MB | scripts/installers/bazel.sh | | 260 MB | scripts/installers/google-chrome.sh | | 203 MB | scripts/installers/1804/basic.sh | | 202 MB | scripts/installers/1804/basic.sh | | 190 MB | scripts/installers/1804/containers.sh | | 164 MB | scripts/installers/powershellcore.sh | | 162 MB | scripts/installers/powershellcore.sh | | 155 MB | scripts/installers/packer.sh | | 155 MB | scripts/installers/azcopy.sh | | 130 MB | scripts/installers/python.sh | | 128 MB | scripts/installers/ansible.sh | | 110 MB | scripts/installers/cmake.sh | | 103 MB | scripts/installers/heroku.sh | | 96 MB | scripts/installers/phantomjs.sh | | 89 MB | scripts/installers/1804/kubernetes-tools.sh | | 75.5 MB | scripts/installers/aws.sh | | 68.4 MB | apt-get -y install sudo lsb-core software-properties-common apt-utils | | 67.3 MB | scripts/installers/ruby.sh | | 53.1 MB | scripts/installers/git.sh | | 52.1 MB | scripts/installers/terraform.sh |
Author
Owner

@github-actions[bot] commented on GitHub (Jun 27, 2020):

Issue is stale and will be closed in 7 days unless there is new activity

<!-- gh-comment-id:650459269 --> @github-actions[bot] commented on GitHub (Jun 27, 2020): Issue is stale and will be closed in 7 days unless there is new activity
Author
Owner

@github-actions[bot] commented on GitHub (Aug 27, 2020):

Issue is stale and will be closed in 7 days unless there is new activity

<!-- gh-comment-id:681190001 --> @github-actions[bot] commented on GitHub (Aug 27, 2020): Issue is stale and will be closed in 7 days unless there is new activity
Author
Owner

@kiptoomm commented on GitHub (Oct 21, 2020):

I got a chance today to start looking into this. I created a tool to convert the upstream ubuntu1804.json into a Dockerfile (I'll release that later) and attempted to build it. A few things:

The total size is now just under 50 GB 🤯

It looks like some new things have been added to the environment since @cplee's image was built.

There are some steps I skipped as they failed and I didn't have time to look into why yet. The skipped steps were:

  • scripts/installers/docker-moby.sh (test failed due to dockerd not running inside container)
  • scripts/helpers/containercache.sh (same as above)
  • scripts/installers/homebrew.sh (refused to be installed as root)
  • scripts/installers/aws-sam-cli.sh (uses homebrew)
  • scripts/installers/mysql.sh (test failed to mysqld not running inside container)
  • scripts/installers/1804/android.sh
  • scripts/installers/vcpkg.sh
  • scripts/installers/1804/php.sh

These were all the steps that resulted in a layer on disk greater than 50 MB.

SIZE CREATED BY
20.4 GB scripts/installers/dotnetcore-sdk.sh
9.3 GB scripts/installers/haskell.sh
7.14 GB scripts/installers/hosted-tool-cache.sh
1.6 GB scripts/installers/swift.sh
1.37 GB scripts/installers/java-tools.sh
1.37 GB scripts/installers/clang.sh
921 MB scripts/installers/azpowershell.sh
527 MB scripts/installers/mono.sh
503 MB scripts/installers/rust.sh
500 MB scripts/installers/azure-cli.sh
382 MB scripts/installers/miniconda.sh
367 MB scripts/installers/nodejs.sh
366 MB scripts/installers/julia.sh
364 MB scripts/installers/google-cloud-sdk.sh
302 MB scripts/installers/mongodb.sh
287 MB scripts/installers/hhvm.sh
271 MB scripts/installers/bazel.sh
260 MB scripts/installers/google-chrome.sh
203 MB scripts/installers/1804/basic.sh
202 MB scripts/installers/1804/basic.sh
190 MB scripts/installers/1804/containers.sh
164 MB scripts/installers/powershellcore.sh
162 MB scripts/installers/powershellcore.sh
155 MB scripts/installers/packer.sh
155 MB scripts/installers/azcopy.sh
130 MB scripts/installers/python.sh
128 MB scripts/installers/ansible.sh
110 MB scripts/installers/cmake.sh
103 MB scripts/installers/heroku.sh
96 MB scripts/installers/phantomjs.sh
89 MB scripts/installers/1804/kubernetes-tools.sh
75.5 MB scripts/installers/aws.sh
68.4 MB apt-get -y install sudo lsb-core software-properties-common apt-utils
67.3 MB scripts/installers/ruby.sh
53.1 MB scripts/installers/git.sh
52.1 MB scripts/installers/terraform.sh

@aidansteele @cplee what happened to this? I am not so familiar with using Docker images so would love it if you can point me to any docs on how to use this slim variant. I tried using ubuntu-latest=nektos/act-environments-ubuntu:18.04 but it looks too large as it's taking forever to load. All I'm trying to do is to use act on paths-filter, a GH Action that requires git

<!-- gh-comment-id:713446077 --> @kiptoomm commented on GitHub (Oct 21, 2020): > I got a chance today to start looking into this. I created a tool to convert the upstream `ubuntu1804.json` into a Dockerfile (I'll release that later) and attempted to build it. A few things: > > The total size is now just under 50 GB 🤯 > > It looks like some new things have been added to the environment since @cplee's image was built. > > There are some steps I skipped as they failed and I didn't have time to look into why yet. The skipped steps were: > > * `scripts/installers/docker-moby.sh` (test failed due to dockerd not running inside container) > * `scripts/helpers/containercache.sh` (same as above) > * `scripts/installers/homebrew.sh` (refused to be installed as root) > * `scripts/installers/aws-sam-cli.sh` (uses homebrew) > * `scripts/installers/mysql.sh` (test failed to mysqld not running inside container) > * `scripts/installers/1804/android.sh` > * `scripts/installers/vcpkg.sh` > * `scripts/installers/1804/php.sh` > > These were all the steps that resulted in a layer on disk greater than 50 MB. > > **SIZE** **CREATED BY** > 20.4 GB scripts/installers/dotnetcore-sdk.sh > 9.3 GB scripts/installers/haskell.sh > 7.14 GB scripts/installers/hosted-tool-cache.sh > 1.6 GB scripts/installers/swift.sh > 1.37 GB scripts/installers/java-tools.sh > 1.37 GB scripts/installers/clang.sh > 921 MB scripts/installers/azpowershell.sh > 527 MB scripts/installers/mono.sh > 503 MB scripts/installers/rust.sh > 500 MB scripts/installers/azure-cli.sh > 382 MB scripts/installers/miniconda.sh > 367 MB scripts/installers/nodejs.sh > 366 MB scripts/installers/julia.sh > 364 MB scripts/installers/google-cloud-sdk.sh > 302 MB scripts/installers/mongodb.sh > 287 MB scripts/installers/hhvm.sh > 271 MB scripts/installers/bazel.sh > 260 MB scripts/installers/google-chrome.sh > 203 MB scripts/installers/1804/basic.sh > 202 MB scripts/installers/1804/basic.sh > 190 MB scripts/installers/1804/containers.sh > 164 MB scripts/installers/powershellcore.sh > 162 MB scripts/installers/powershellcore.sh > 155 MB scripts/installers/packer.sh > 155 MB scripts/installers/azcopy.sh > 130 MB scripts/installers/python.sh > 128 MB scripts/installers/ansible.sh > 110 MB scripts/installers/cmake.sh > 103 MB scripts/installers/heroku.sh > 96 MB scripts/installers/phantomjs.sh > 89 MB scripts/installers/1804/kubernetes-tools.sh > 75.5 MB scripts/installers/aws.sh > 68.4 MB apt-get -y install sudo lsb-core software-properties-common apt-utils > 67.3 MB scripts/installers/ruby.sh > 53.1 MB scripts/installers/git.sh > 52.1 MB scripts/installers/terraform.sh @aidansteele @cplee what happened to this? I am not so familiar with using Docker images so would love it if you can point me to any docs on how to use this slim variant. I tried using `ubuntu-latest=nektos/act-environments-ubuntu:18.04` but it looks too large as it's taking forever to load. All I'm trying to do is to use `act` on [paths-filter](https://github.com/dorny/paths-filter), [a GH Action that requires git](https://github.com/dorny/paths-filter/issues/39)
Author
Owner

@pimterry commented on GitHub (Oct 22, 2020):

I've found an interesting alternative approach. I'm using this as my base image: https://github.com/httptoolkit/act-build-base/blob/main/Dockerfile

In effect, I'm sticking with a plain node base image, and just mixing in individual installers for the specific parts of the standard image I need, directly pulling individual scripts from act-environments.

Maybe there's a route through here? The installer scripts aren't quite as easy to use standalone right now as they could be (e.g. they don't work without document.sh preloaded into the right path) but with a few small tweaks there I can imagine an Act readme that said you can either:

  • Use the full-fat act-environments image
  • Use a base template, and pull in whichever of the below parts of the core build are relevant for your use case.

For people like me, that'd be pretty useful - doing this seems to work perfectly, it's very easy, and it saves me an enormous amount of disk space.

For GitHub themselves it makes sense to provide an actions base that includes the kitchen sink, but no individual devs need all of that locally for every build.

<!-- gh-comment-id:714495231 --> @pimterry commented on GitHub (Oct 22, 2020): I've found an interesting alternative approach. I'm using this as my base image: https://github.com/httptoolkit/act-build-base/blob/main/Dockerfile In effect, I'm sticking with a plain node base image, and just mixing in individual installers for the specific parts of the standard image I need, directly pulling individual scripts from `act-environments`. Maybe there's a route through here? The installer scripts aren't quite as easy to use standalone right now as they could be (e.g. they don't work without document.sh preloaded into the right path) but with a few small tweaks there I can imagine an Act readme that said you can either: * Use the full-fat act-environments image * Use a base template, and pull in whichever of the below parts of the core build are relevant for your use case. For people like me, that'd be pretty useful - doing this seems to work perfectly, it's very easy, and it saves me an enormous amount of disk space. For GitHub themselves it makes sense to provide an actions base that includes the kitchen sink, but no individual devs need all of that locally for every build.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#133
No description provided.