Merge pull request #951 from linuxserver/universal-calibre-bundle-binaries

This commit is contained in:
Adam 2024-09-11 19:59:52 +01:00 committed by GitHub
commit a68c477065
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 43 deletions

View File

@ -1,12 +1,21 @@
name: Build Image
on: [push, pull_request_target, workflow_dispatch]
on:
push:
pull_request_target:
workflow_dispatch:
inputs:
mod_version:
type: string
required: false
env:
MOD_VERSION: ${{ inputs.mod_version }}
GITHUB_REPO: "linuxserver/docker-mods" #don't modify
ENDPOINT: "linuxserver/mods" #don't modify
BASEIMAGE: "universal" #replace
MODNAME: "calibre" #replace
MULTI_ARCH: "true" #set to false if not needed
jobs:
set-vars:
@ -19,15 +28,23 @@ jobs:
echo "ENDPOINT=${{ env.ENDPOINT }}" >> $GITHUB_OUTPUT
echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT
echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT
echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
MOD_VERSION=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" | jq -r '.tag_name')
if [[ -z "${{ env.MOD_VERSION }}" ]]; then
MOD_VERSION=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" | jq -r '.tag_name')
else
MOD_VERSION=${{ env.MOD_VERSION }}
echo "MOD_VERSION_OVERRIDE=true" >> $GITHUB_OUTPUT
fi
echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT
outputs:
GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }}
ENDPOINT: ${{ steps.outputs.outputs.ENDPOINT }}
BASEIMAGE: ${{ steps.outputs.outputs.BASEIMAGE }}
MODNAME: ${{ steps.outputs.outputs.MODNAME }}
MULTI_ARCH: ${{ steps.outputs.outputs.MULTI_ARCH }}
MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }}
MOD_VERSION_OVERRIDE: ${{ steps.outputs.outputs.MOD_VERSION_OVERRIDE }}
build:
uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1
@ -42,4 +59,6 @@ jobs:
ENDPOINT: ${{ needs.set-vars.outputs.ENDPOINT }}
BASEIMAGE: ${{ needs.set-vars.outputs.BASEIMAGE }}
MODNAME: ${{ needs.set-vars.outputs.MODNAME }}
MULTI_ARCH: ${{ needs.set-vars.outputs.MULTI_ARCH }}
MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }}
MOD_VERSION_OVERRIDE: ${{ needs.set-vars.outputs.MOD_VERSION_OVERRIDE }}

View File

@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1
## Buildstage ##
FROM ghcr.io/linuxserver/baseimage-alpine:3.19 AS buildstage
FROM ghcr.io/linuxserver/baseimage-alpine:3.20 AS buildstage
ARG MOD_VERSION
@ -12,6 +12,15 @@ RUN \
MOD_VERSION=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" \
| jq -r '.tag_name'); \
fi && \
if [ "$(uname -m)" == "x86_64" ]; then \
curl -o \
/root-layer/calibre.txz -L \
"https://download.calibre-ebook.com/${MOD_VERSION:1}/calibre-${MOD_VERSION:1}-x86_64.txz"; \
elif [ "$(uname -m)" == "aarch64" ]; then \
curl -o \
/root-layer/calibre.txz -L \
"https://download.calibre-ebook.com/${MOD_VERSION:1}/calibre-${MOD_VERSION:1}-arm64.txz"; \
fi && \
echo $MOD_VERSION > /root-layer/CALIBRE_RELEASE
# copy local files

View File

@ -1,20 +1,6 @@
#!/usr/bin/with-contenv bash
if [[ "$(uname -m)" == "armv7l" ]]; then
cat <<-EOF
********************************************************
********************************************************
* *
* !!!! *
* universal-calibre mod is not supported on armhf. *
* *
********************************************************
********************************************************
EOF
exit 0
fi
if [ ! -f /usr/bin/apt ]; then
if [[ ! -f /usr/bin/apt ]]; then
cat <<-EOF
********************************************************
********************************************************
@ -31,33 +17,11 @@ fi
export DEBIAN_FRONTEND="noninteractive"
CALIBRE_RELEASE="$(cat /CALIBRE_RELEASE)"
if [ -z ${CALIBRE_RELEASE+x} ]; then
CALIBRE_RELEASE=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi
if [ ! -e /usr/bin/calibre-server ] || [ "${CALIBRE_RELEASE}" != "$(cat /config/.CALIBRE_RELEASE || :)" ]; then
echo "**** Installing/updating calibre ****"
rm -rf /app/calibre
mkdir -p \
/app/calibre
if [ "$(uname -m)" == "x86_64" ]; then
curl -o \
/tmp/calibre.txz -L \
"https://github.com/kovidgoyal/calibre/releases/download/${CALIBRE_RELEASE}/calibre-${CALIBRE_RELEASE:1}-x86_64.txz"
elif [ "$(uname -m)" == "aarch64" ]; then
curl -o \
/tmp/calibre.txz -L \
"https://github.com/kovidgoyal/calibre/releases/download/${CALIBRE_RELEASE}/calibre-${CALIBRE_RELEASE:1}-arm64.txz"
fi
if [[ -e /tmp/calibre.txz ]]; then
tar xf \
/tmp/calibre.txz \
-C /app/calibre
rm /tmp/calibre.txz
echo "Installing Calibre version $(cat /CALIBRE_RELEASE)"
/app/calibre/calibre_postinstall
echo "${CALIBRE_RELEASE}" > /config/.CALIBRE_RELEASE
else
echo "**** Calibre already installed, skipping ****"
rm /tmp/calibre.txz
fi