Files
boringproxy/scripts/upload_docker_github.sh
Willem@105.pve1.lan 9a4863c4f4 build files using docker
2022-02-18 14:30:12 +02:00

33 lines
774 B
Bash
Executable File

#!/bin/bash
# This file is used to upload a build docker image to GitHub.
# Run build_docker.sh first to create new image
# Run from root boringproxy folder and call with ./scripts/upload_docker_image.sh github-username
# github-username must be lowercase
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
if [ -z "$1" ];
then {
echo "Container name required";
exit;
}
fi
if [ -z "$2" ];
then echo "GitHub username required";
else {
if [ -z "$3" ];
then {
echo "No TAG set, using latest";
tag='latest';
}
else tag=$3;
fi
docker image tag $1 ghcr.io/$2/$1:$tag
CR_PAT=`cat ~/.auth_tokens/github`
echo $CR_PAT | docker login ghcr.io -u $2 --password-stdin
docker push ghcr.io/$2/$1:$tag
} fi