Chainguard wolfi-base image as base for docker (#68) #565
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create and publish k8s workbench container image | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- "main" | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: harbor-day2-operator | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: hadolint/hadolint-action@v3.1.0 | |
with: | |
dockerfile: Dockerfile | |
- uses: ricardochaves/python-lint@v1.4.0 | |
with: | |
use-pylint: false | |
use-flake8: false | |
use-black: false | |
use-mypy: false | |
use-isort: false | |
- name: Log in to the container registry | |
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for container | |
id: meta | |
uses: docker/metadata-action@44d81d6d2a5a935e1a481942268529623f1f5ccd | |
with: | |
images: ${{ env.REGISTRY }}/steadforce/steadops/workbenches/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Build container image for tests | |
uses: docker/build-push-action@5e99dacf67635c4f273e532b9266ddb609b3025a | |
with: | |
context: . | |
push: false | |
tags: ${{ env.IMAGE_NAME }}:test | |
- name: Test harbor tool | |
run: | | |
docker run --rm ${{ env.IMAGE_NAME }}:test /usr/local/harbor --help | |
- name: Tag and push tested container image | |
uses: docker/build-push-action@5e99dacf67635c4f273e532b9266ddb609b3025a | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |