Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host spectral in a pre-built container image #452

Open
mzabaluev opened this issue Feb 11, 2021 · 2 comments
Open

Host spectral in a pre-built container image #452

mzabaluev opened this issue Feb 11, 2021 · 2 comments

Comments

@mzabaluev
Copy link

User story.

As a workflow user, I should not wait while spectral is being rebuilt into a Docker container for every run, so that I can enjoy super-fast job completion times.

Is your feature request related to a problem?

The action rebuilds and sets up Spectral in its entirety into a Docker image, with no caching seemingly occurring between job runs. This costs about 1.5 minutes for every job, not to mention taxing the public infrastructure of npm, Docker Hub, and possibly other web resources.

Describe the solution you'd like

Don't know the details of how actions can deploy containers, but I would imagine building a Docker image once per spectral update (or any change in the Dockerfile), pushing it to a registry (the one provided by GitHub, to keep things close?) and then pulling it in the action would speed up the jobs.

@jiridj
Copy link

jiridj commented Jun 16, 2022

Why use a container at all? Wouldn't using plain NodeJS instead of Docker make it even faster as no container needs to be pulled?

@rapita
Copy link

rapita commented Oct 20, 2022

I had the same problem.

Building docker image by stoplightio/spectral-action on every workflow trigger - is a very sub-optimal solution. 100 runs - 100 minutes only for building docker image OMG...

Solved by:

      - name: Run Spectral Lint
        uses: addnab/docker-run-action@v3
        with:
          image: stoplight/spectral:latest
          options: -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }}
          run: spectral lint --ruleset ./docs/spectral/bundled.spectral.yml ./docs/specification/*.yaml

Results:
Build addnab/docker-run-action@v3 - 8s
Run Spectral Lint - 6s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants