-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fa244e
commit 3fc73f2
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push events but only for the "master" branch | ||
push: | ||
branches: ["master"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v4 | ||
|
||
# - name: "Login to GitHub Container Registry" | ||
# uses: docker/login-action@v1 | ||
# with: | ||
# registry: ghcr.io | ||
# username: ${{github.actor}} | ||
# password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
# - name: Pull image | ||
# run: | | ||
# make pull | ||
# make push | ||
|
||
- name: Check image | ||
run: make check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
MAKEFLAGS += --always-make | ||
|
||
all: pull push | ||
|
||
check: | ||
python scripts/digest.py | ||
|
||
pull: | ||
docker pull docker.io/mingzhebaosheng/directory-lister:4.0.0 | ||
docker image ls | ||
|
||
push: | ||
docker tag docker.io/mingzhebaosheng/directory-lister:4.0.0 ghcr.io/podboy/directory-lister:4.0.0 | ||
docker image ls | ||
docker push ghcr.io/podboy/directory-lister:4.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import requests | ||
import json | ||
|
||
# 设置你的Docker镜像名和tag | ||
image_name = "library/ubuntu" | ||
tag_name = "latest" | ||
|
||
# 设置Docker Registry的地址 | ||
registry_url = "https://registry-1.docker.io" | ||
|
||
# 构造请求manifest的URL | ||
manifest_url = f"{registry_url}/v2/{image_name}/manifests/{tag_name}" | ||
|
||
# 发送请求获取manifest | ||
response = requests.get(manifest_url) | ||
|
||
# 检查请求是否成功 | ||
if response.status_code == 200: | ||
# 解析JSON数据 | ||
manifest = json.loads(response.content) | ||
|
||
# 打印hash值 | ||
config_digest = manifest["config"]["digest"] | ||
print(f"The hash for the tag is: {config_digest}") | ||
else: | ||
print("Failed to fetch manifest") |