Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 23 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fcb7a97
fix: [#34] added workflow to generate mcvs-registry docker image
jherrerasbp Dec 26, 2024
2e2d5a2
fix: [#34] fixed linter warnings
jherrerasbp Dec 26, 2024
9867490
fix: [#34] added tmp mcvs-docker-action version to text build with co…
jherrerasbp Dec 27, 2024
cb71c19
fix: [#34] changes to resolve PR feedback
jherrerasbp Dec 27, 2024
27e2080
fix: [#34] updated dockerfile context path
jherrerasbp Dec 27, 2024
0fc754e
fix: [#34] added missing permissions to manage docker images
jherrerasbp Dec 27, 2024
618503f
fix: [#34] removed buildx
jherrerasbp Dec 27, 2024
672f3ca
fix: [#34] upgraded pkgs to fix vulns
jherrerasbp Dec 27, 2024
f205e44
fix: [#34] updated registry base image to RC to solve vulns
jherrerasbp Dec 27, 2024
0f351d3
fix: [#34] added trivy ignore file
jherrerasbp Dec 27, 2024
14e3801
fix: [#34] removed condition block to test pulling of images
jherrerasbp Dec 27, 2024
b534c16
fix: [#34] updated docker github action version
jherrerasbp Dec 27, 2024
284b146
fix: [#34] added go setup
jherrerasbp Dec 27, 2024
2c8358c
fix: [#34] added regctl version for test
jherrerasbp Dec 27, 2024
71daae7
fix: [#34] removed condition for testing
jherrerasbp Dec 27, 2024
d43efac
fix: [#34] added shell parameter
jherrerasbp Dec 27, 2024
cc68aad
fix: [#34] added print ls -la
jherrerasbp Dec 27, 2024
1588ffe
fix: [#34] added cat to regctl
jherrerasbp Dec 27, 2024
b7bd698
fix: [#34] added cat to regctl
jherrerasbp Dec 27, 2024
940cef8
fix: [#34] removed condition for testing
jherrerasbp Dec 27, 2024
bd884f3
fix: [#34] added correct version of regctl
jherrerasbp Dec 27, 2024
97356eb
fix: [#34] disabled regctl tls for local registry
jherrerasbp Dec 27, 2024
55f02cc
fix: [#34] added condition to prevent images pulling
jherrerasbp Dec 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/docker-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
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: v0.8.0
REGISTRY_LOCAL: localhost:5000
REGISTRY_REMOTE: public.ecr.aws
REGISTRY_VERSION: 3.0.0-rc.2
jherrerasbp marked this conversation as resolved.
Show resolved Hide resolved
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
jherrerasbp marked this conversation as resolved.
Show resolved Hide resolved
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 }}

# 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: ghcr.io/${{ github.repository }}/${{ matrix.build-args }}
token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CVE-2024-45338 exp:2025-01-26
10 changes: 10 additions & 0 deletions registry/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM registry:3.0.0-rc.2
ARG APPLICATION
RUN apk update && \
apk upgrade
# A custom config file is needed to disable default cache
# By default the cache is "blobdescriptor: inmemory"
# The config-example.yml file of this repo disables it
# https://github.com/distribution/distribution-library-image
COPY ./config-example.yml /etc/docker/registry/config.yml
COPY ./backup-registry /var/lib/registry
19 changes: 19 additions & 0 deletions registry/config-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: ""
jherrerasbp marked this conversation as resolved.
Show resolved Hide resolved
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
Loading