Skip to content

Commit d416c18

Browse files
authored
Merge pull request #838 from linuxserver/code-server-dotnet-multi
dotnet: switch to multi-arch
2 parents 17f7b26 + 992698e commit d416c18

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed

.github/workflows/BuildImage.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ env:
77
ENDPOINT: "linuxserver/mods" #don't modify
88
BASEIMAGE: "code-server" #replace
99
MODNAME: "dotnet" #replace
10+
MULTI_ARCH: "true" #set to true if needed
1011

1112
jobs:
1213
set-vars:
@@ -19,6 +20,7 @@ jobs:
1920
echo "ENDPOINT=${{ env.ENDPOINT }}" >> $GITHUB_OUTPUT
2021
echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT
2122
echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT
23+
echo "MULTI_ARCH=${{ env.MULTI_ARCH }}" >> $GITHUB_OUTPUT
2224
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
2325
DOTNET_JSON="$(curl --retry 5 -sX GET https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json)"
2426
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:
2830
ENDPOINT: ${{ steps.outputs.outputs.ENDPOINT }}
2931
BASEIMAGE: ${{ steps.outputs.outputs.BASEIMAGE }}
3032
MODNAME: ${{ steps.outputs.outputs.MODNAME }}
33+
MULTI_ARCH: ${{ steps.outputs.outputs.MULTI_ARCH }}
3134
MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }}
3235

3336
build:
@@ -43,4 +46,5 @@ jobs:
4346
ENDPOINT: ${{ needs.set-vars.outputs.ENDPOINT }}
4447
BASEIMAGE: ${{ needs.set-vars.outputs.BASEIMAGE }}
4548
MODNAME: ${{ needs.set-vars.outputs.MODNAME }}
49+
MULTI_ARCH: ${{ needs.set-vars.outputs.MULTI_ARCH }}
4650
MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }}

Dockerfile

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-alpine:3.18 as buildstage
3+
FROM ghcr.io/linuxserver/baseimage-alpine:3.19 as buildstage
44

55
ARG MOD_VERSION
66

77
RUN \
8-
DOTNET_JSON=$(curl -sX GET "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json") && \
9-
if [ -z ${MOD_VERSION+x} ]; then \
8+
DOTNET_JSON=$(curl -sX GET "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json") && \
9+
if [ -z ${MOD_VERSION+x} ]; then \
1010
MOD_VERSION=$(echo "$DOTNET_JSON" | jq -r '."releases-index"[] | select(."support-phase"=="active" or ."support-phase"=="maintenance") | ."latest-sdk"' | tr '\n' '_' | head -c -1); \
11-
fi && \
12-
DOTNET_VERSIONS="${MOD_VERSION//_/ }" && \
13-
mkdir -p /root-layer/dotnet && \
14-
echo "$DOTNET_VERSIONS" > /root-layer/dotnet/versions.txt && \
15-
echo "versions are ${DOTNET_VERSIONS}" && \
16-
for i in $DOTNET_VERSIONS; do \
17-
echo "processing version ${i}" && \
11+
fi && \
12+
DOTNET_VERSIONS="${MOD_VERSION//_/ }" && \
13+
mkdir -p /root-layer/dotnet && \
14+
echo "$DOTNET_VERSIONS" > /root-layer/dotnet/versions.txt && \
15+
echo "versions are ${DOTNET_VERSIONS}" && \
16+
for i in $DOTNET_VERSIONS; do \
1817
DOTNET_RELEASE_URL=$(echo "${DOTNET_JSON}" | jq -r ".\"releases-index\"[] | select(.\"latest-sdk\"==\"${i}\") | .\"releases.json\"") && \
1918
DOTNET_RELEASE_JSON=$(curl -fSsLX GET "${DOTNET_RELEASE_URL}") && \
20-
AMD64_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-x64.tar.gz\")) | .url") && \
21-
ARM64_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-arm64.tar.gz\")) | .url") && \
19+
if [ $(uname -m) = "x86_64" ]; then \
20+
echo "**** Downloading x86_64 tarball for version ${i} ****" && \
21+
TARBALL_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-x64.tar.gz\")) | .url"); \
22+
elif [ $(uname -m) = "aarch64" ]; then \
23+
echo "**** Downloading aarch64 tarball for version ${i} ****" && \
24+
TARBALL_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-arm64.tar.gz\")) | .url"); \
25+
fi && \
2226
curl -fSL --retry 3 --retry-connrefused -o \
23-
/root-layer/dotnet/dotnetsdk_"${i}"_x86_64.tar.gz -L \
24-
"${AMD64_URL}" && \
25-
curl -fSL --retry 3 --retry-connrefused -o \
26-
/root-layer/dotnet/dotnetsdk_"${i}"_aarch64.tar.gz -L \
27-
"${ARM64_URL}" || exit 1; \
28-
done
27+
/root-layer/dotnet/dotnetsdk_"${i}".tar.gz -L \
28+
"${TARBALL_URL}" || exit 1; \
29+
done
2930

3031
COPY root/ /root-layer/
3132

root/etc/s6-overlay/s6-rc.d/init-mod-code-server-dotnet-add-package/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if [ -d /dotnet ]; then
2323
DOTNET_VERSIONS=$(cat /dotnet/versions.txt)
2424
for i in $DOTNET_VERSIONS; do
2525
mkdir -p "/dotnet_${i}"
26-
tar xzf "/dotnet/dotnetsdk_${i}_${ARCH}.tar.gz" -C "/dotnet_${i}"
26+
tar xzf "/dotnet/dotnetsdk_${i}.tar.gz" -C "/dotnet_${i}"
2727
done
2828
rm -rf /dotnet
2929
# symlink latest dotnet binary

0 commit comments

Comments
 (0)