Skip to content

Commit

Permalink
fix: [#34] added workflow to generate mcvs-registry docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
jherrerasbp committed Dec 26, 2024
1 parent 7ac6697 commit fcb7a97
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/docker-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and publish Docker Registry image

Check warning on line 1 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-integrationtest-services)

1:1 [document-start] missing document start "---"

Check warning on line 1 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-stub-server)

1:1 [document-start] missing document start "---"

Check warning on line 1 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / build-and-publish (mcvs-registry)

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-integrationtest-services)

3:1 [truthy] truthy value should be one of [false, true]

Check warning on line 3 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-stub-server)

3:1 [truthy] truthy value should be one of [false, true]

Check warning on line 3 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / build-and-publish (mcvs-registry)

3:1 [truthy] truthy value should be one of [false, true]
push:
tags:
- "*"
paths:
- "registry/**"
pull_request:
paths:
- "registry/**"

env:
REGISTRY_VERSION: 2.8.3
REGCTL_VERSION: 0.8.0
DOCKERFILE_CONTEXT: registry

jobs:
build-and-publish:
runs-on: ubuntu-latest

strategy:
matrix:
build-args:
- mcvs-registry

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- 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/')
run: |
# run local tmp registry
docker run -d -p 5000:5000 --name mcvs-registry-tmp registry:${{ env.REGISTRY_VERSION }}

Check failure on line 46 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-integrationtest-services)

46:81 [line-length] line too long (98 > 80 characters)

Check failure on line 46 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-stub-server)

46:81 [line-length] line too long (98 > 80 characters)

Check failure on line 46 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / build-and-publish (mcvs-registry)

46:81 [line-length] line too long (98 > 80 characters)
# copy specififc images from specific sources
regctl image copy --digest-tags public.ecr.aws/datadog/agent:7.59.0 localhost:5000/datadog/agent:7.59.0

Check failure on line 49 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-integrationtest-services)

49:81 [line-length] line too long (113 > 80 characters)

Check failure on line 49 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-stub-server)

49:81 [line-length] line too long (113 > 80 characters)

Check failure on line 49 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / build-and-publish (mcvs-registry)

49:81 [line-length] line too long (113 > 80 characters)
regctl image copy --digest-tags public.ecr.aws/nginx/nginx:1.27.0 localhost:5000/nginx/nginx:1.27.0

Check failure on line 50 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-integrationtest-services)

50:81 [line-length] line too long (109 > 80 characters)

Check failure on line 50 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-stub-server)

50:81 [line-length] line too long (109 > 80 characters)

Check failure on line 50 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / build-and-publish (mcvs-registry)

50:81 [line-length] line too long (109 > 80 characters)
# export images files to backup directory
docker cp mcvs-registry-tmp:/var/lib/registry ./${{ env.DOCKERFILE_CONTEXT }}/backup-registry

Check failure on line 53 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-integrationtest-services)

53:81 [line-length] line too long (103 > 80 characters)

Check failure on line 53 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-stub-server)

53:81 [line-length] line too long (103 > 80 characters)

Check failure on line 53 in .github/workflows/docker-registry.yml

View workflow job for this annotation

GitHub Actions / build-and-publish (mcvs-registry)

53:81 [line-length] line too long (103 > 80 characters)
# clean up the registry container
docker rm -f mcvs-registry-tmp
- name: Run MCVS Docker Action
uses: schubergphilis/[email protected]
with:
build-args: ${{ matrix.build-args }}
dockle-accept-key: "curl,HOME,libcrypto3,libssl3,PATH"
images: ghcr.io/${{ github.repository }}/${{ matrix.build-args }}
token: "${{ secrets.GITHUB_TOKEN }}"
# context: ${{ env.DOCKERFILE_CONTEXT }}
5 changes: 5 additions & 0 deletions registry/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM registry:2.8.3

COPY ./backup-registry /var/lib/registry

COPY ./config-example.yml /etc/docker/registry/config.yml
18 changes: 18 additions & 0 deletions registry/config-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 0.1

Check warning on line 1 in registry/config-example.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-integrationtest-services)

1:1 [document-start] missing document start "---"

Check warning on line 1 in registry/config-example.yml

View workflow job for this annotation

GitHub Actions / mcvs-docker-action (mcvs-stub-server)

1:1 [document-start] missing document start "---"

Check warning on line 1 in registry/config-example.yml

View workflow job for this annotation

GitHub Actions / build-and-publish (mcvs-registry)

1:1 [document-start] missing document start "---"
log:
fields:
service: registry
storage:
cache:
blobdescriptor: ""
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

0 comments on commit fcb7a97

Please sign in to comment.