Skip to content

Commit

Permalink
fix: [#34] added extra step to retrieve the registry content (#45)
Browse files Browse the repository at this point in the history
* fix: [#34] added extra step to retrieve the registry content

* fix: [#34] fixed longline linter issue

* fix: [#34] updated mcvs-registry workflow conditions

* fix: [#34] removed curl --silent

* fix: [#34] added commands to show image contents

* fix: [#34] updated docker commands

* fix: [#34] ls dirs

* fix: [#34] ls backup-registry dir

* fix: [#34] added ls

* fix: [#34] modified docker cp

* fix: [#34] removed ls commands
  • Loading branch information
jherrerasbp authored Dec 31, 2024
1 parent 63cd92f commit e7ed387
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ name: docker-mcvs-registry
- "*"
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_MANIFEST_LIST: datadog/agent:7.59.0
IMAGE_MANIFEST_SINGLE: nginx/nginx:1.27.0
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
Expand All @@ -37,11 +42,11 @@ jobs:
- 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
# run local registry
docker run -d \
-p 5000:5000 \
--name mcvs-registry-tmp \
Expand All @@ -67,7 +72,7 @@ jobs:
# export images files to backup directory
docker \
cp \
mcvs-registry-tmp:/var/lib/registry \
mcvs-registry-tmp:/var/lib/registry/. \
${{ env.DOCKERFILE_CONTEXT }}/backup-registry
# clean up the registry container
Expand All @@ -78,5 +83,23 @@ jobs:
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 }}
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
6 changes: 3 additions & 3 deletions registry/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ RUN apk update && \
# https://github.com/distribution/distribution-library-image
# File is copied to two different locations to keep
# compatibility with registry:2.x and registry:3.x
COPY ./config-example.yml /etc/docker/registry/config.yml
COPY ./config-example.yml /etc/distribution/config.yml
COPY ./backup-registry /var/lib/registry
COPY config-example.yml /etc/docker/registry/config.yml
COPY config-example.yml /etc/distribution/config.yml
COPY backup-registry /var/lib/registry

0 comments on commit e7ed387

Please sign in to comment.