Skip to content

Commit

Permalink
* update skopeo
Browse files Browse the repository at this point in the history
  • Loading branch information
ysicing committed Oct 18, 2024
1 parent 5524b5b commit d7947c9
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 8 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/skopeo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build Skopeo

env:
TZ: Asia/Shanghai

on:
schedule:
- cron: '0 8 * * 6'
push:
branches:
- master
jobs:
build:
name: build skopeo image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCRIO }}
- name: Login DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build skopeo
uses: docker/build-push-action@v6
with:
context: skopeo
platforms: linux/amd64,linux/arm64
push: true
pull: true
tags: |
ghcr.io/ysicing/skopeo
ysicing/skopeo
ttl.sh/ysicing/skopeo
- name: Trivy vulnerability scanner skopeo
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/ysicing/skopeo'
format: 'github'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
21 changes: 13 additions & 8 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@ vars:

tasks:
debian:
desc: build debian image
cmds:
- docker buildx build --pull --platform linux/amd64,linux/arm64 -t ysicing/debian -t ysicing/debian:{{.BUILD_DATE}} -t ghcr.io/ysicing/debian -t ttl.sh/core/debian --push debian
- curl -s https://cr.hk1.godu.dev/pull\?image=ysicing/debian

god:
desc: build go debian image
cmds:
# - mkdir -p god/bin
# - wget https://github.com/upx/upx/releases/download/v4.1.0/upx-4.1.0-amd64_linux.tar.xz
# - tar -Jxf upx*.tar.xz
# - mv upx*/upx god/bin/
# - defer: rm -rf upx*
# - defer: rm -rf god/bin
- docker buildx build --pull --platform linux/amd64,linux/arm64 -t ysicing/god -t ysicing/god:{{.BUILD_DATE}} -t ghcr.io/ysicing/god -t ttl.sh/core/god --push god
- curl -s https://cr.hk1.godu.dev/pull\?image=ysicing/god

registry:
desc: build registry image
cmds:
- docker buildx build --pull --platform linux/amd64 -t ysicing/registry -t ysicing/registry:{{.BUILD_DATE}} -t ttl.sh/core/registry --push registry

skopeo:
desc: build skopeo image
cmds:
- docker buildx build --pull --platform linux/amd64,linux/arm64 -t ysicing/registry -t ysicing/skopeo:{{.BUILD_DATE}} -t ttl.sh/core/skopeo -t ghcr.io/ysicing/skopeo --push skopeo

default:
cmds:
- task: debian
- task: god
- task: skopeo
19 changes: 19 additions & 0 deletions registry/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ysicing/debian AS Get

RUN wget https://github.com/distribution/distribution/releases/download/v2.8.3/registry_2.8.3_linux_amd64.tar.gz \
&& tar -zxvf registry_2.8.3_linux_amd64.tar.gz \
&& mv registry /usr/bin/registry

FROM ysicing/debian

COPY --from=Get /usr/bin/registry /usr/bin/registry

COPY config.yml /config.yml

COPY entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh

EXPOSE 5000

ENTRYPOINT ["/entrypoint.sh"]
25 changes: 25 additions & 0 deletions registry/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 0.1
log:
fields:
service: registry
storage:
delete:
enabled: true
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
Access-Control-Expose-Headers: ['Docker-Content-Digest']
Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE']
Access-Control-Allow-Origin: ['*']
proxy:
remoteurl: https://registry-1.docker.io
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
11 changes: 11 additions & 0 deletions registry/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

if [ -n "$PROXY_REMOTE_URL" ]; then
sed -i "s|registry-1.docker.io|$PROXY_REMOTE_URL|g" /config.yml
fi

if [ "$1" == "bash" ]; then
exec /bin/bash
else
exec /usr/bin/registry serve /config.yml
fi
13 changes: 13 additions & 0 deletions skopeo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ysicing/debian

RUN set -x \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y skopeo \
&& apt-get autoremove \
&& apt-get clean \
&& rm -rf \
/tmp/* \
/var/tmp/* \
/var/lib/apt/lists/*

ENTRYPOINT ["/usr/bin/skopeo"]

0 comments on commit d7947c9

Please sign in to comment.