Git Product home page Git Product logo

act-docker-images's Introduction

🐳 Docker images for nektos/act

Docker Pulls Docker Image Size Docker Stars Github stars Github forks Github issues Github last-commit

ci workflow badge MegaLinter Docker-Hub description workflow badge Mergify badge License badge

What

The containers in this repository are made to be used with nektos/act, which is a very handy tool to execute, test and debug github workflows locally.

If you don't know it yet, I highly recommend to check it out πŸ€“

Why

Since I had trouble with other images when executing azure related tools, I decided to create my own container which is heavily inspired by the images of catthehacker and the official runner images.

How to use

These Docker images are intended to be used with nektos/act. Setup guides can be found here.

Add these lines in ~/.actrc to use this image with act:

-P ubuntu-latest=mauwii/ubuntu-act:latest
-P ubuntu-22.04=mauwii/ubuntu-act:22.04
-P ubuntu-20.04=mauwii/ubuntu-act:20.04

For further information about nektos/act and how to use it, take a πŸ‘€ at the nektos documentationπŸ“–

How to run act on apple silicon πŸ’»

  • Install act via brew🍺

    brew install act

    [!IMPORTANT]
    Use act --version to make sure you have at least act version 0.2.51, which came with support for node20

  • set an alias to always pass the GITHUB_TOKEN (requires github-cli (brew install gh))

    if command -v act >/dev/null 2>&1; then
        alias act='act -s GITHUB_TOKEN="$(gh auth token)"'
    elif gh extension list | grep -q "nektos/gh-act"; then
        alias act='gh act -s GITHUB_TOKEN="$(gh auth token)"'
    fi
  • 🐳 Docker-Desktop settings:

    • Docker Engine (~/.docker/daemon.json):

      {
        "builder": {
          "gc": {
            "defaultKeepStorage": "20GB",
            "enabled": true
          }
        },
        "experimental": true,
        "features": {
          "buildkit": true
        }
      }
    • Features in Development:

      • ❌ containerd
      • ❌ wasm
      • βœ… rosetta
      • βœ… builds view
    • Advanced:

      • ❌ system
      • βœ… user
      • βœ… Allow the default Docker socket to be used
      • ❌ Allow privileged port mapping
      • βœ… Automatically check configuration
  • ~/.actrc:

    --container-architecture linux/arm64
    --rm=true
    --reuse=false
    -P ubuntu-latest=mauwii/ubuntu-act:latest
    -P ubuntu-22.04=mauwii/ubuntu-act:22.04
    -P ubuntu-20.04=mauwii/ubuntu-act:20.04

docker-bake file

As always, there are different options to build the images locally. I added docker-bake.hcl which helps with orchestrating builds but needs buildx to be available on the host (it comes out of the box with docker desktop).

Warning

Bake Files are still considered experimental, and your results may be totally different depending on your local docker configuration.

  • using the local tag:

    docker buildx bake \
        --set "*.platform=linux/$(uname -m)"
  • using the current branch as a tag name and set better labels, without pushing the cache to the registry:

    GITHUB_SHA="$(git rev-parse HEAD)" \
    REF_NAME="$(git rev-parse --abbrev-ref HEAD)" \
    docker buildx bake \
        --set="*.cache-to=" \
        --set="*.platform=linux/$(uname -m)"

    When you do this from the main branch and already use the latest image, it will be replaced with the one you just built.

mega-linter

To execute the mega-linter locally without the needs to install it, there are different options:

  • you can use act (I assume you run act the way I just explained):

    act -W .github/workflows/mega-linter.yml

    This has the advantage that megalinter executes with the same settings as the workflow itself, while not providing fixed versions if errors where found.

  • or you could use npx:

    npx mega-linter-runner \
        --flavor terraform \
        --remove-container

Pre-Commit-Hook

I integrated a pre-commit hook to run mega-linter. There are different ways to install pre-commit on your system. I used brew since I am working on MacOS (brew install pre-commit). Another easy way would be via pipx.

After successfully installing pre-commit on your system, you need to run pre-commit install in the repository root if you want to enable the pre-commit hooks on your system as well.

act-docker-images's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar mauwii avatar mergify[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.