Publish registry image with skopeo
This commit is contained in:
+10
-14
@@ -32,24 +32,20 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Buildah
|
- name: Install Docker and Skopeo
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y buildah
|
apt-get install -y docker.io skopeo
|
||||||
|
|
||||||
- name: Login to Gitea Registry
|
|
||||||
env:
|
|
||||||
REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
|
|
||||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
printf '%s' "${REGISTRY_PASSWORD}" | buildah login --tls-verify=false -u "${GITHUB_REPOSITORY_OWNER}" --password-stdin "${REGISTRY_HOST}"
|
|
||||||
|
|
||||||
- name: Build and Push Image
|
- name: Build and Push Image
|
||||||
env:
|
env:
|
||||||
REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
|
REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
run: |
|
run: |
|
||||||
export BUILDAH_ISOLATION=chroot
|
local_image="${GITHUB_REPOSITORY##*/}:ci"
|
||||||
image="${REGISTRY_HOST}/${GITHUB_REPOSITORY}"
|
archive="/tmp/${GITHUB_REPOSITORY##*/}.tar"
|
||||||
buildah bud --storage-driver=vfs --format docker -t "${image}:main" -t "${image}:sha-${GITHUB_SHA}" .
|
docker build -t "${local_image}" .
|
||||||
buildah push --tls-verify=false "${image}:main"
|
docker save "${local_image}" -o "${archive}"
|
||||||
buildah push --tls-verify=false "${image}:sha-${GITHUB_SHA}"
|
for tag in main "sha-${GITHUB_SHA}"; do
|
||||||
|
skopeo copy --dest-creds "${GITHUB_REPOSITORY_OWNER}:${REGISTRY_PASSWORD}" --dest-tls-verify=false "docker-archive:${archive}" "docker://${REGISTRY_HOST}/${GITHUB_REPOSITORY}:${tag}"
|
||||||
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user