mirror of
https://github.com/linuxserver/docker-mods.git
synced 2026-03-23 00:05:28 +08:00
dotnet: switch to multi-arch
This commit is contained in:
parent
17f7b26bbd
commit
992698efaf
4
.github/workflows/BuildImage.yml
vendored
4
.github/workflows/BuildImage.yml
vendored
@ -7,6 +7,7 @@ env:
|
||||
ENDPOINT: "linuxserver/mods" #don't modify
|
||||
BASEIMAGE: "code-server" #replace
|
||||
MODNAME: "dotnet" #replace
|
||||
MULTI_ARCH: "true" #set to true if needed
|
||||
|
||||
jobs:
|
||||
set-vars:
|
||||
@ -19,6 +20,7 @@ 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. ****
|
||||
DOTNET_JSON="$(curl --retry 5 -sX GET https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json)"
|
||||
MOD_VERSION="$(echo $DOTNET_JSON | jq -r '."releases-index"[] | select(."support-phase"=="active" or ."support-phase"=="maintenance") | ."latest-sdk"' | tr '\n' '_' | head -c -1)"
|
||||
@ -28,6 +30,7 @@ jobs:
|
||||
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 }}
|
||||
|
||||
build:
|
||||
@ -43,4 +46,5 @@ 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 }}
|
||||
|
||||
37
Dockerfile
37
Dockerfile
@ -1,31 +1,32 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine:3.18 as buildstage
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine:3.19 as buildstage
|
||||
|
||||
ARG MOD_VERSION
|
||||
|
||||
RUN \
|
||||
DOTNET_JSON=$(curl -sX GET "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json") && \
|
||||
if [ -z ${MOD_VERSION+x} ]; then \
|
||||
DOTNET_JSON=$(curl -sX GET "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json") && \
|
||||
if [ -z ${MOD_VERSION+x} ]; then \
|
||||
MOD_VERSION=$(echo "$DOTNET_JSON" | jq -r '."releases-index"[] | select(."support-phase"=="active" or ."support-phase"=="maintenance") | ."latest-sdk"' | tr '\n' '_' | head -c -1); \
|
||||
fi && \
|
||||
DOTNET_VERSIONS="${MOD_VERSION//_/ }" && \
|
||||
mkdir -p /root-layer/dotnet && \
|
||||
echo "$DOTNET_VERSIONS" > /root-layer/dotnet/versions.txt && \
|
||||
echo "versions are ${DOTNET_VERSIONS}" && \
|
||||
for i in $DOTNET_VERSIONS; do \
|
||||
echo "processing version ${i}" && \
|
||||
fi && \
|
||||
DOTNET_VERSIONS="${MOD_VERSION//_/ }" && \
|
||||
mkdir -p /root-layer/dotnet && \
|
||||
echo "$DOTNET_VERSIONS" > /root-layer/dotnet/versions.txt && \
|
||||
echo "versions are ${DOTNET_VERSIONS}" && \
|
||||
for i in $DOTNET_VERSIONS; do \
|
||||
DOTNET_RELEASE_URL=$(echo "${DOTNET_JSON}" | jq -r ".\"releases-index\"[] | select(.\"latest-sdk\"==\"${i}\") | .\"releases.json\"") && \
|
||||
DOTNET_RELEASE_JSON=$(curl -fSsLX GET "${DOTNET_RELEASE_URL}") && \
|
||||
AMD64_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-x64.tar.gz\")) | .url") && \
|
||||
ARM64_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-arm64.tar.gz\")) | .url") && \
|
||||
if [ $(uname -m) = "x86_64" ]; then \
|
||||
echo "**** Downloading x86_64 tarball for version ${i} ****" && \
|
||||
TARBALL_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-x64.tar.gz\")) | .url"); \
|
||||
elif [ $(uname -m) = "aarch64" ]; then \
|
||||
echo "**** Downloading aarch64 tarball for version ${i} ****" && \
|
||||
TARBALL_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-arm64.tar.gz\")) | .url"); \
|
||||
fi && \
|
||||
curl -fSL --retry 3 --retry-connrefused -o \
|
||||
/root-layer/dotnet/dotnetsdk_"${i}"_x86_64.tar.gz -L \
|
||||
"${AMD64_URL}" && \
|
||||
curl -fSL --retry 3 --retry-connrefused -o \
|
||||
/root-layer/dotnet/dotnetsdk_"${i}"_aarch64.tar.gz -L \
|
||||
"${ARM64_URL}" || exit 1; \
|
||||
done
|
||||
/root-layer/dotnet/dotnetsdk_"${i}".tar.gz -L \
|
||||
"${TARBALL_URL}" || exit 1; \
|
||||
done
|
||||
|
||||
COPY root/ /root-layer/
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ if [ -d /dotnet ]; then
|
||||
DOTNET_VERSIONS=$(cat /dotnet/versions.txt)
|
||||
for i in $DOTNET_VERSIONS; do
|
||||
mkdir -p "/dotnet_${i}"
|
||||
tar xzf "/dotnet/dotnetsdk_${i}_${ARCH}.tar.gz" -C "/dotnet_${i}"
|
||||
tar xzf "/dotnet/dotnetsdk_${i}.tar.gz" -C "/dotnet_${i}"
|
||||
done
|
||||
rm -rf /dotnet
|
||||
# symlink latest dotnet binary
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user