Skip to content

nasa-pds-engineering-node/github-actions-base

 
 

Repository files navigation

🌄 PDS Engineering Actions: Base Image

GitHub Actions let you run workflows for software repositories for such things as continuous integration, code quality, documentation extraction, continuous delivery, and so forth. The Planetary Data System (PDS) uses GitHub Actions for these purposes.

Workflows consist of actions, each of which can be executed using JavaScript, so-called "composite" actions (essentially shell macros), or as Docker containers. Docker-based actions give you the most flexibility, letting you define your action in whatever programming language you enjoy with access to whatever libraries and APIs are convenient (so long as it's a Linux-based container).

However, Docker-based actions are the slowest in GitHub Actions as GitHub spins up a new Docker machine, builds your image, installs it into a container, runs it, and then tears it all down for every execution of your action. For actions that require a lot of setup (in terms of C libraries, Python dependencies, Java APIs, and so forth), this can make execution painfully slow.

Enter this image. By deriving specific GitHub Actions from this image, we make a "snapshot" of all the dependencies typically needed by GitHub actions in one place.

Of course, this makes a few assumptions:

  • PDS GitHub actions will need Python 3.9.7.
  • They'll run on Alpine Linux 3.14.
  • They'll have access to development tools:
    • GCC
    • MUSL C library
    • OpenSSL
    • libxml2, libxslt, and libffi
    • GnuPG
  • But wait there's more
    • Git
    • Ruby (yes, in addition to Python)
    • Java (yes, in addition to Ruby)

And we might expand on this in the future.

ℹ️ Using this Base

To use this base image in your own Docker-based action, simply derive from it in your action's Dockerfile:

FROM nasapds/github-actions-base:latest

# Action-specific stuff here

🔧 Maintaining this Base

To update this base image, just make changes to the Dockerfile and, if needed, the m2-repository.tar.bz2.

To make a release of this image on the Docker Hub, do a push to GitHub:

  • A push to the main branch will trigger an automatic build of the image with the :latest tag and push it to nasapds/github-actions-base:latest on the Docker Hub.
  • A push to a vX.Y.Z tag will trigger an automatic build of the image with the :X.Y.Z tag and push it to nasapds/github-actions-base:X.Y.Z, where X.Y.Z is a semantic version.

But if you ever need to do that by hand, try this:

docker image build --tag github-actions-base:latest .
docker image tag github-actions-base:latest nasapds/github-actions-base:latest
docker login
docker image push nasapds/github-actions-base:latest

Substitute :latest with whatever's appropriate.

⏰ Future Work

About

Base Docker image for GitHub Actions for PDS

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dockerfile 100.0%