Skip to content

fix: [#34] added extra step to retrieve the registry content #9

fix: [#34] added extra step to retrieve the registry content

fix: [#34] added extra step to retrieve the registry content #9

Workflow file for this run

---
name: docker-mcvs-registry
"on":
push:
tags:
- "*"
paths:
- "registry/**"
- ".github/workflows/mcvs-registry.yml"
pull_request:
paths:
- "registry/**"
- ".github/workflows/mcvs-registry.yml"
permissions:
contents: read
packages: write
env:
DOCKERFILE_CONTEXT: ./registry
IMAGE_NAME: mcvs-registry
IMAGE_REPO: ghcr.io/${{ github.repository }}
IMAGE_TAG: pr-${{ github.event.number }}
IMAGE_MANIFEST_LIST: nginx/nginx:1.27.0-alpine
IMAGE_MANIFEST_SINGLE: nginx/nginx:1.27.0-alpine-slim-amd64
REGCTL_VERSION: v0.8.0
REGISTRY_LOCAL: localhost:5000
REGISTRY_REMOTE: public.ecr.aws
REGISTRY_VERSION: 3.0.0-rc.2
jobs:
build-and-publish:
runs-on: ubuntu-22.04
strategy:
matrix:
build-args:
- mcvs-registry
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Install regctl
uses: regclient/actions/regctl-installer@main
with:
release: ${{ env.REGCTL_VERSION }}
- name: Create registry backup directory
run: mkdir -p ${{ env.DOCKERFILE_CONTEXT }}/backup-registry
- name: Pull images data and prepare context directory
shell: bash
run: |
#!/bin/bash
# run local registry
docker run -d \
-p 5000:5000 \
--name mcvs-registry-tmp \
registry:${{ env.REGISTRY_VERSION }}
# disable tls for local tmp registry
regctl registry set --tls disabled ${{ env.REGISTRY_LOCAL }}
# import image with manifest list
regctl \
image \
copy --digest-tags \
${{ env.REGISTRY_REMOTE }}/${{ env.IMAGE_MANIFEST_LIST }} \
${{ env.REGISTRY_LOCAL }}/${{ env.IMAGE_MANIFEST_LIST }}
# import image with single manifest
regctl \
image \
copy --digest-tags \
${{ env.REGISTRY_REMOTE }}/${{ env.IMAGE_MANIFEST_SINGLE }} \
${{ env.REGISTRY_LOCAL }}/${{ env.IMAGE_MANIFEST_SINGLE }}
# export images files to backup directory
docker \
cp \
mcvs-registry-tmp:/var/lib/registry/. \
${{ env.DOCKERFILE_CONTEXT }}/backup-registry
# clean up the registry container
docker rm -f mcvs-registry-tmp
- uses: schubergphilis/[email protected]
with:
build-args: ${{ matrix.build-args }}
context: ${{ env.DOCKERFILE_CONTEXT }}
dockle-accept-key: "curl,HOME,libcrypto3,libssl3,PATH"
images: ${{ env.IMAGE_REPO }}/${{ matrix.build-args }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get new registry catalog
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
#!/bin/bash
docker images
docker run -d \
-p 5001:5000 \
--name mcvs-registry \
${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
docker ps
curl http://localhost:5001/v2/_catalog
docker rm --force mcvs-registry