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

Skopeo (Docker container) sync #66

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions skopeo-sync/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM ustcmirror/base:alpine-edge
LABEL maintainer "Keyu Tao <taoky AT ustclug.org>"
RUN apk add --no-cache skopeo
ADD sync.sh /
18 changes: 18 additions & 0 deletions skopeo-sync/sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

VERIFY_TLS=${VERIFY_TLS:-"false"}

if [ ! -f /etc/skopeo-images.yaml ]; then
echo "Please bind mount skopeo config file to /etc/skopeo-images.yaml"
exit 255
fi

if [ -n "$NEEDS_LOGIN" ]; then
skopeo login --tls-verify="$VERIFY_TLS" "$REGISTRY_HOST" -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD"
if [ $? -ne 0 ]; then
echo "Registry login failed"
exit 255
fi
fi

exec skopeo --insecure-policy sync --dest-tls-verify="$VERIFY_TLS" --scoped --src yaml --dest docker /etc/skopeo-images.yaml "$REGISTRY_HOST"