Skip to content

Commit

Permalink
Merge pull request #19 from vishnoianil/publish-ui-image
Browse files Browse the repository at this point in the history
Publish ui container image to ghcr.io
  • Loading branch information
nerdalert authored Jun 25, 2024
2 parents a6d423f + 5e72785 commit 7821b39
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish container images

on:
push:
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/ui

jobs:
build_and_publish_ui_image:
name: Push UI container image to GHCR
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write

steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/setup-buildx-action@v3

- name: Extract metadata (tags, labels) for UI image
id: ui_meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push ui image
id: push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.ui_meta.outputs.tags }}
labels: ${{ steps.ui_meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
target: ui
cache-from: type=gha
cache-to: type=gha,mode=max
file: Containerfile

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-18s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

#
# If you want to see the full commands, run:
# NOISY_BUILD=y make
#
ifeq ($(NOISY_BUILD),)
ECHO_PREFIX=@
CMD_PREFIX=@
PIPE_DEV_NULL=> /dev/null 2> /dev/null
else
ECHO_PREFIX=@\#
CMD_PREFIX=
PIPE_DEV_NULL=
endif

.PHONY: md-lint
md-lint: ## Lint markdown files
$(ECHO_PREFIX) printf " %-12s ./...\n" "[MD LINT]"
$(CMD_PREFIX) podman run --rm -v $(CURDIR):/workdir docker.io/davidanson/markdownlint-cli2:v0.6.0 > /dev/null

.PHONY: action-lint
action-lint: ## Lint GitHub Action workflows
$(ECHO_PREFIX) printf " %-12s .github/...\n" "[ACTION LINT]"
$(CMD_PREFIX) if ! which actionlint $(PIPE_DEV_NULL) ; then \
echo "Please install actionlint." ; \
echo "go install github.com/rhysd/actionlint/cmd/actionlint@latest" ; \
exit 1 ; \
fi
$(CMD_PREFIX) actionlint -color

ui-image: Containerfile ## Build continaer image for the InstructLab UI
$(ECHO_PREFIX) printf " %-12s Containerfile\n" "[PODMAN]"
$(CMD_PREFIX) podman build -f Containerfile -t ghcr.io/instructlab/ui/ui:main .

0 comments on commit 7821b39

Please sign in to comment.