Skip to content

Push the base image after it's creation #255

@dannystaple

Description

@dannystaple

The npm stage of the docker base stage can take some time. Time for other operations could be saved by having this base stored as a docker image in github.

Can a workflow store the result of the base image build? We will address pulling this in a later ticket, but for now let's just make it available.

I'm thinking that the following would be appropriate in on_call_build_site:

  • Use the base image name ghcr.io/orionrobots/orionrobots-site.base.
  • An input push tag - this would be a version/tag for after the colon.
  • This workflow should always build the image - it will be in use for the following stages anyway. Do this before the named "build the site with docker compose" stage.
  • If input push tag is set, push the base image using the specified tag. Push only after the other build stages are completed, such that they can gate the pushing - failed builds should not push an image.

Then the following workflows would be adjusted to modify it:

  • .github/workflows/on_push_to_master_test_and_deploy.yaml would set the push tag to latest.
  • .github/workflows/on_pr_test.yaml - this is a little trickier.
    • Use tj_actions changed files (with a sha version reference so it is somewhat protected against supply chain compromises) to verify if the following have changed in the pr:
      • the Dockerfile
      • packages.json/packages.lock
      • The on_call_build_site workflow
      • The on pr test workflow
    • If it has changed, provide a push tag of the pr number. Otherwise, do not set the parameter.

Do not attempt to add code to pull/make use of this artifact just yet - that will be addressed in a later ticket.

Acceptance criteria

  • All modified files follow the editorconfig standards (pre-commit should help)
  • The on_call_build_site workflow should build a base image.
  • The on call build site should only push the image when other build stages have completed.
  • PR conditions should only expect to push the image when relevant files changed.
  • The push to master job should call it with the tag latest
  • This PR would have created an appropriately tagged base docker image package.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions