Skip to content

fix: [#34] added workflow to generate mcvs-registry docker image #19

fix: [#34] added workflow to generate mcvs-registry docker image

fix: [#34] added workflow to generate mcvs-registry docker image #19

Workflow file for this run

---
name: docker-mcvs-registry
"on":
push:
tags:
- "*"
paths:
- "registry/**"
pull_request:
paths:
- "registry/**"
permissions:
contents: read
packages: write
env:
DOCKERFILE_CONTEXT: ./registry
IMAGE_MANIFEST_LIST: datadog/agent:7.59.0
IMAGE_MANIFEST_SINGLE: nginx/nginx:1.27.0
REGCTL_VERSION: 0.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
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
#!/bin/bash
docker run -d \
-p 5000:5000 \
--name mcvs-registry-tmp \
registry:${{ env.REGISTRY_VERSION }}
echo $GITHUB_PATH
ls -la $HOME
ls -la $HOME/.regctl
ls -la $HOME/.regctl/bin
cat $HOME/.regctl/bin/regctl
regctl \
image \
copy --digest-tags \
${{ env.REGISTRY_REMOTE }}/${{ env.IMAGE_MANIFEST_LIST }} \
${{ env.REGISTRY_LOCAL }}/${{ env.IMAGE_MANIFEST_LIST }}
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: ghcr.io/${{ github.repository }}/${{ matrix.build-args }}
token: ${{ secrets.GITHUB_TOKEN }}