remove httpie from image #70
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
--- | |
name: docker build | |
on: | |
push: | |
paths-ignore: | |
- 'README.md' | |
- 'LICENSE' | |
repository_dispatch: ~ | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- dockerfile: Dockerfile | |
mainTag: latest | |
prepend: "" | |
- dockerfile: Dockerfile.alpine | |
mainTag: alpine | |
prepend: alpine- | |
steps: | |
- uses: actions/[email protected] | |
- name: Docker Setup Buildx | |
uses: docker/[email protected] | |
- name: Version check | |
shell: bash | |
run: | | |
# start of script | |
function get_token() { | |
local image=$1 | |
curl -sS \ | |
"https://auth.docker.io/token?scope=repository:$image:pull&service=registry.docker.io" \ | |
| jq -r '.token' | |
} | |
function get_digest() { | |
local image=$1 | |
local tag=$2 | |
local token=$3 | |
curl -sSL \ | |
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \ | |
--header "Authorization: Bearer $token" \ | |
"https://registry-1.docker.io/v2/$image/manifests/$tag" \ | |
| jq -r '.manifests[] | select(.platform.architecture == "amd64").digest' | |
} | |
function get_image_configuration() { | |
local image=$1 | |
local token=$2 | |
local digest=$3 | |
curl -sSL --header "Authorization: Bearer $token" \ | |
"https://registry-1.docker.io/v2/$image/blobs/$digest" \ | |
| jq -r '.container_config' | |
} | |
function get_image_info { | |
local image="devster31/qbittorrent-filebot" | |
local token | |
token=$(get_token $image) | |
local digest | |
digest=$(get_digest "${image}" "${tag:-latest}" "${token}") | |
get_image_configuration "${image}" "${token}" "${digest}" | |
} | |
EXT_S6_VER=$(get_image_info | jq -r '.Labels."org.opencontainers.image.s6-overlay.version"') | |
EXT_FB_VER=$(get_image_info | jq -r '.Labels."org.opencontainers.image.filebot.version"') | |
EXT_QB_VER=$(get_image_info | jq -r '.Labels."org.opencontainers.image.qbittorrent.version"') | |
EXT_VT_VER=$(get_image_info | jq -r '.Labels."org.opencontainers.image.vuetorrent.version"') | |
S6_URL=https://api.github.com/repos/just-containers/s6-overlay/releases/latest | |
RESP=$(curl -Ls -w "%{http_code}" -o /dev/null "${S6_URL}") | |
if [ "${RESP}" == 200 ]; then | |
CUR_S6_VER=$(curl -sS "${S6_URL}" | jq --raw-output '.tag_name') | |
else | |
echo "::error ::Unable to get the URL:${S6_URL}" | |
exit 1 | |
fi | |
VT_URL=https://api.github.com/repos/WDaan/VueTorrent/releases/latest | |
RESP=$(curl -Ls -w "%{http_code}" -o /dev/null "${VT_URL}") | |
if [ "${RESP}" == 200 ]; then | |
CUR_VT_VER=$(curl -sS "${VT_URL}" | jq --raw-output '.tag_name') | |
else | |
echo "::error ::Unable to get the URL:${VT_URL}" | |
exit 1 | |
fi | |
FB_DEB_URL="https://get.filebot.net/deb/dists/stable/main/binary-amd64/Packages" | |
RESP=$(curl -Ls -w "%{http_code}" -o /dev/null "${FB_DEB_URL}") | |
if [ "${RESP}" == 200 ]; then | |
CUR_FB_VER=$(curl -sSX GET "${FB_DEB_URL}" | awk -F ': ' '/Version/{print $2;exit}') | |
else | |
echo "::error ::Unable to get the URL:${QB_DEB_URL}" | |
exit 1 | |
fi | |
QB_DEB_URL=http://ppa.launchpad.net/qbittorrent-team/qbittorrent-stable/ubuntu/dists/lunar/main/binary-amd64/Packages.gz | |
QB_PKG=qbittorrent-nox | |
RESP=$(curl -Ls -w "%{http_code}" -o /dev/null "${QB_DEB_URL}") | |
if [ "${RESP}" == 200 ]; then | |
CUR_QB_VER=$(curl -sSX GET "${QB_DEB_URL}" | gunzip -c | \ | |
awk -F ': ' "/Package: ${QB_PKG}/,/Version/{ y = \$0 } END { split(y, a) ; print a[2] }") | |
else | |
echo "::error ::Unable to get the URL:${QB_DEB_URL}" | |
exit 1 | |
fi | |
SHORT_TAG=$(echo "${CUR_QB_VER}" | awk -F '[:~]' '{ print $2 }') | |
FULL_TAG=qbt-v$(echo "${CUR_QB_VER}" | awk -F '[:~]' '{ print $2 }')-fb-v"${CUR_FB_VER}" | |
if [ "${CUR_QB_VER}" != "${EXT_QB_VER}" ] || \ | |
[ "${CUR_FB_VER}" != "${EXT_FB_VER}" ] || \ | |
[ "${CUR_S6_VER//v}" != "${EXT_S6_VER}" ] || \ | |
[ "${CUR_VT_VER//v}" != "${EXT_VT_VER}" ]; then | |
RUN_BUILD=yes | |
else | |
RUN_BUILD=no | |
fi | |
{ | |
echo "short_tag=${SHORT_TAG}" | |
echo "full_tag=${FULL_TAG}" | |
echo "qb_version=${CUR_QB_VER}" | |
echo "fb_version=${CUR_FB_VER}" | |
echo "s6_version=${CUR_S6_VER//v}" | |
echo "vt_version=${CUR_VT_VER//v}" | |
echo "trigger=${RUN_BUILD}" | |
} >> "$GITHUB_OUTPUT" | |
id: version_check | |
- name: Docker Login | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.docker_hub_username }} | |
password: ${{ secrets.docker_hub_password }} | |
- name: Build and push Docker images | |
uses: docker/[email protected] | |
if: success() && steps.version_check.outputs.trigger == 'yes' | |
with: | |
context: . | |
file: ./${{ matrix.dockerfile }} | |
push: true | |
build-args: | | |
SHORT_TAG_VER=${{ steps.version_check.outputs.short_tag }} | |
FULL_TAG_VER=${{ steps.version_check.outputs.full_tag }} | |
QBITTORRENT_VER=${{ steps.version_check.outputs.qb_version }} | |
FILEBOT_VER=${{ steps.version_check.outputs.fb_version }} | |
S6_OVERLAY_VER=${{ steps.version_check.outputs.s6_version }} | |
VUETORRENT_VER=${{ steps.version_check.outputs.vt_version }} | |
tags: | | |
devster31/qbittorrent-filebot:${{ matrix.mainTag }} | |
devster31/qbittorrent-filebot:${{ matrix.prepend }}${{ steps.version_check.outputs.short_tag }} | |
devster31/qbittorrent-filebot:${{ matrix.prepend }}${{ steps.version_check.outputs.full_tag }} | |
... |