Publish registry image with skopeo
This commit is contained in:
+10
-14
@@ -32,24 +32,20 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Buildah
|
||||
- name: Install Docker and Skopeo
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y buildah
|
||||
|
||||
- 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}"
|
||||
apt-get install -y docker.io skopeo
|
||||
|
||||
- name: Build and Push Image
|
||||
env:
|
||||
REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
export BUILDAH_ISOLATION=chroot
|
||||
image="${REGISTRY_HOST}/${GITHUB_REPOSITORY}"
|
||||
buildah bud --storage-driver=vfs --format docker -t "${image}:main" -t "${image}:sha-${GITHUB_SHA}" .
|
||||
buildah push --tls-verify=false "${image}:main"
|
||||
buildah push --tls-verify=false "${image}:sha-${GITHUB_SHA}"
|
||||
local_image="${GITHUB_REPOSITORY##*/}:ci"
|
||||
archive="/tmp/${GITHUB_REPOSITORY##*/}.tar"
|
||||
docker build -t "${local_image}" .
|
||||
docker save "${local_image}" -o "${archive}"
|
||||
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