Skip to content

Commit

Permalink
Push Dockerfile to registry using go-makefile-maker
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Sep 4, 2024
1 parent 4102a5e commit a11bae0
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
"default:pinDigestsDisabled",
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/container-registry-ghcr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
################################################################################
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
# Edit Makefile.maker.yaml instead. #
################################################################################

name: Container Registry GHCR
"on":
push:
tags:
- '*'
permissions:
contents: read
packages: write
jobs:
build-and-push-image:
name: Push container to ghcr.io
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
username: ${{ github.actor }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
# https://github.com/docker/metadata-action#typeedge
type=edge
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
################################################################################
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
# Edit Makefile.maker.yaml instead. #
################################################################################

MAKEFLAGS=--warn-undefined-variables
# /bin/sh is dash on Debian which does not support all features of ash/bash
# to fix that we use /bin/bash only on Debian to not break Alpine
Expand All @@ -7,9 +12,17 @@ ifneq (,$(wildcard /etc/os-release)) # check file existence
endif
endif

default: FORCE
@echo 'There is nothing to build, use `make check` for running the test suite or `make help` for a list of available targets.'

prepare-static-check: FORCE
@if ! hash addlicense 2>/dev/null; then printf "\e[1;36m>> Installing addlicense...\e[0m\n"; go install github.com/google/addlicense@latest; fi

# to get around weird Makefile syntax restrictions, we need variables containing nothing, a space and comma
null :=
space := $(null) $(null)
comma := ,

license-headers: FORCE prepare-static-check
@printf "\e[1;36m>> addlicense\e[0m\n"
@addlicense -c "SAP SE" -- $(shell find -name *.rs)
Expand All @@ -21,4 +34,22 @@ check-license-headers: FORCE prepare-static-check
clean: FORCE
git clean -dxf build

vars: FORCE
help: FORCE
@printf "\n"
@printf "\e[1mUsage:\e[0m\n"
@printf " make \e[36m<target>\e[0m\n"
@printf "\n"
@printf "\e[1mGeneral\e[0m\n"
@printf " \e[36mvars\e[0m Display values of relevant Makefile variables.\n"
@printf " \e[36mhelp\e[0m Display this help.\n"
@printf "\n"
@printf "\e[1mPrepare\e[0m\n"
@printf " \e[36mprepare-static-check\e[0m Install any tools required by static-check. This is used in CI before dropping privileges, you should probably install all the tools using your package manager\n"
@printf "\n"
@printf "\e[1mDevelopment\e[0m\n"
@printf " \e[36mlicense-headers\e[0m Add license headers to all non-vendored source code files.\n"
@printf " \e[36mcheck-license-headers\e[0m Check license headers in all non-vendored .go files.\n"
@printf " \e[36mclean\e[0m Run git clean.\n"

.PHONY: FORCE
16 changes: 16 additions & 0 deletions Makefile.maker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Configuration file for <https://github.com/sapcc/go-makefile-maker>

metadata:
url: https://github.com/sapcc/pear-reviewer

githubWorkflow:
global:
defaultBranch: master
pushContainerToGhcr:
enabled: true
tagStrategy: [ edge ]

renovate:
enabled: true
assignees:
- SuperSandro2000

0 comments on commit a11bae0

Please sign in to comment.