Publish to the runner local Gitea registry
This commit is contained in:
@@ -39,12 +39,12 @@ jobs:
|
||||
|
||||
- name: Configure Registry Auth
|
||||
env:
|
||||
REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
push_host="$(git remote get-url origin | sed -E 's#^[a-z]+://([^/]+)/.*#\1#')"
|
||||
mkdir -p "${HOME}/.docker"
|
||||
auth="$(printf '%s:%s' "${GITHUB_REPOSITORY_OWNER}" "${REGISTRY_PASSWORD}" | base64 -w0)"
|
||||
printf '{"auths":{"%s":{"auth":"%s"}}}\n' "${REGISTRY_HOST}" "${auth}" > "${HOME}/.docker/config.json"
|
||||
printf '{"auths":{"%s":{"auth":"%s"}}}\n' "${push_host}" "${auth}" > "${HOME}/.docker/config.json"
|
||||
chmod 600 "${HOME}/.docker/config.json"
|
||||
|
||||
- name: Install ko
|
||||
@@ -52,8 +52,8 @@ jobs:
|
||||
|
||||
- name: Build and Push Image
|
||||
env:
|
||||
REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
|
||||
KO_DEFAULTBASEIMAGE: gcr.io/distroless/static-debian12:nonroot
|
||||
run: |
|
||||
export KO_DOCKER_REPO="${REGISTRY_HOST}/${GITHUB_REPOSITORY_OWNER}"
|
||||
push_host="$(git remote get-url origin | sed -E 's#^[a-z]+://([^/]+)/.*#\1#')"
|
||||
export KO_DOCKER_REPO="${push_host}/${GITHUB_REPOSITORY_OWNER}"
|
||||
ko build --base-import-paths --insecure-registry --sbom=none --tags "main,sha-${GITHUB_SHA}" .
|
||||
|
||||
@@ -57,7 +57,7 @@ It runs on pushes to `main` and pull requests, and currently:
|
||||
- runs `go build .`
|
||||
- builds and pushes `:main` and `:sha-<commit>` container tags on pushes to `main`
|
||||
|
||||
The workflow expects a runner with the `ubuntu-latest` label, a repository Actions secret named `REGISTRY_PASSWORD`, and a repository variable named `REGISTRY_HOST` for the registry hostname.
|
||||
The workflow expects a runner with the `ubuntu-latest` label and a repository Actions secret named `REGISTRY_PASSWORD`.
|
||||
|
||||
The cluster runner deployed for this repo provides the required runner label.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user