Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
Push docker images to ghcr.io
Browse files Browse the repository at this point in the history
  • Loading branch information
ferferga committed Feb 25, 2021
1 parent 7ab28f4 commit c2d3a77
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Dockerfile.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ FROM jellyfin/jellyfin-server:${TARGET_RELEASE}-amd64 as server
FROM jellyfin/jellyfin-web:${TARGET_RELEASE} as web
FROM debian:buster-slim

LABEL maintainer "Jellyfin Packaging Team - packaging@jellyfin.org"
LABEL org.opencontainers.image.source https://github.com/jellyfin/jellyfin

# Default environment variables for the Jellyfin invocation
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT="1" \
LC_ALL="en_US.UTF-8" \
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu
FROM jellyfin/jellyfin-server:${TARGET_RELEASE}-arm64 as server
FROM jellyfin/jellyfin-web:${TARGET_RELEASE} as web
FROM arm64v8/debian:buster-slim

LABEL maintainer "Jellyfin Packaging Team - packaging@jellyfin.org"
LABEL org.opencontainers.image.source https://github.com/jellyfin/jellyfin

COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin

# Default environment variables for the Jellyfin invocation
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ FROM multiarch/qemu-user-static:x86_64-arm as qemu
FROM jellyfin/jellyfin-server:${TARGET_RELEASE}-armhf as server
FROM jellyfin/jellyfin-web:${TARGET_RELEASE} as web
FROM arm32v7/debian:buster-slim

LABEL maintainer "Jellyfin Packaging Team - packaging@jellyfin.org"
LABEL org.opencontainers.image.source https://github.com/jellyfin/jellyfin

COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin

# Default environment variables for the Jellyfin invocation
Expand Down
13 changes: 11 additions & 2 deletions collect-server.azure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,11 @@ do_docker_meta() {

# Push the images
for arch in ${docker_arches[@]}; do
echo "Pushing Docker image for ${arch}"
echo "Pushing Docker image to DockerHub for ${arch}"
docker push "${docker_image}":"${cversion}-${arch}" 1>&2
echo "Pushing Docker image to ghcr.io for ${arch}"
docker tag "${docker_image}":"${cversion}-${arch}" ghcr.io/"${docker_image}":"${cversion}-${arch}" 1>&2
docker push ghcr.io/"${docker_image}":"${cversion}-${arch}" 1>&2
done

# Create the manifests
Expand All @@ -496,16 +499,22 @@ do_docker_meta() {

docker manifest create --amend "${docker_image}":"${cversion}" ${image_list_cversion} 1>&2
docker manifest create --amend "${docker_image}":"${group_tag}" ${image_list_grouptag} 1>&2
docker manifest create --amend ghcr.io/"${docker_image}":"${cversion}" ${image_list_cversion} 1>&2
docker manifest create --amend ghcr.io/"${docker_image}":"${group_tag}" ${image_list_grouptag} 1>&2

# Push the manifests
echo "Pushing Docker image manifests"
echo "Pushing Docker image manifests to DockerHub"
docker manifest push --purge "${docker_image}":"${cversion}" 1>&2
docker manifest push --purge "${docker_image}":"${group_tag}" 1>&2
echo "Pushing Docker image manifests to ghcr.io"
docker manifest push --purge ghcr.io/"${docker_image}":"${cversion}" 1>&2
docker manifest push --purge ghcr.io/"${docker_image}":"${group_tag}" 1>&2

# Remove images
for arch in ${docker_arches[@]}; do
echo "Removing pushed docker image for ${arch}"
docker image rm "${docker_image}":"${cversion}-${arch}" 1>&2
docker image rm ghcr.io/"${docker_image}":"${cversion}-${arch}" 1>&2
done
docker image prune --force 1>&2

Expand Down
33 changes: 33 additions & 0 deletions utils/transfer_ghcr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# One time script to repush docker images from DockerHub to ghcr.io
username="jellyfin"
# Github package registry. You need to be logged in first
target_repo="ghcr.io"
img_file="image_list.txt"
tag_file="tag_list.txt"
rm -rf $img_file

wget -q https://hub.docker.com/v2/repositories/$username/ -O - | jq -r '.results[] | . | .namespace + "/" + .name' >> $img_file

while read -r line; do
original_image="$line"
new_image="$original_image"
rm -rf $tag_file
wget -q https://hub.docker.com/v1/repositories/$original_image/tags -O - | jq -r '.[] | .name' >> $tag_file

while read -r line2; do
tag="$line2"
docker pull $original_image:$tag
docker tag $original_image:$tag $target_repo/$new_image:$tag
docker push $target_repo/$new_image:$tag
done < "$tag_file"

while read -r line3; do
tag="$line3"
# Delete already pushed images
docker image rm $original_image:$tag
docker image rm $target_repo/$new_image:$tag
done < "$tag_file"
done < "$img_file"

rm -rf $img_file

0 comments on commit c2d3a77

Please sign in to comment.