mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-19 01:46:10 -04:00
Merge pull request #76 from linuxserver/code-server-dotnet-dev
code-server-dotnet: initial release
This commit is contained in:
+13
-6
@@ -4,16 +4,16 @@ language: shell
|
|||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- <baseimagename>-<modname> #replace variables, omit brackets
|
- code-server-dotnet
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- DOCKERHUB="linuxserver/mods" #don't modify
|
- DOCKERHUB="linuxserver/mods"
|
||||||
- BASEIMAGE="baseimagename" #replace
|
- BASEIMAGE="code-server"
|
||||||
- MODNAME="modname" #replace
|
- MODNAME="dotnet"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
@@ -21,15 +21,22 @@ jobs:
|
|||||||
if: (type IN (pull_request))
|
if: (type IN (pull_request))
|
||||||
script:
|
script:
|
||||||
# Build image
|
# Build image
|
||||||
- docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} .
|
- DOTNET_JSON="$(curl --retry 5 -sX GET https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json)"
|
||||||
|
- DOTNET_VERSIONS="$(echo $DOTNET_JSON | jq -r '."releases-index"[] | select(."support-phase"=="lts") | ."latest-sdk"' | tr '\n' ' ' | head -c -1)"
|
||||||
|
- docker build --no-cache --build-arg DOTNET_VERSIONS="${DOTNET_VERSIONS}" -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} .
|
||||||
- stage: BuildImage
|
- stage: BuildImage
|
||||||
if: (NOT (type IN (pull_request)))
|
if: (NOT (type IN (pull_request)))
|
||||||
script:
|
script:
|
||||||
# Build image
|
# Build image
|
||||||
- docker build --no-cache -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} .
|
- DOTNET_JSON="$(curl --retry 5 -sX GET https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json)"
|
||||||
|
- DOTNET_VERSIONS="$(echo $DOTNET_JSON | jq -r '."releases-index"[] | select(."support-phase"=="lts") | ."latest-sdk"' | tr '\n' ' ' | head -c -1)"
|
||||||
|
- DOTNET_TAG="$(echo $DOTNET_VERSIONS | tr ' ' '_')"
|
||||||
|
- docker build --no-cache --build-arg DOTNET_VERSIONS="${DOTNET_VERSIONS}" -t ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} .
|
||||||
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
|
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
|
||||||
|
- docker tag ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT} ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${DOTNET_TAG}
|
||||||
# Login to DockerHub
|
# Login to DockerHub
|
||||||
- echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
|
- echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
|
||||||
# Push all of the tags
|
# Push all of the tags
|
||||||
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT}
|
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${TRAVIS_COMMIT}
|
||||||
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
|
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}
|
||||||
|
- docker push ${DOCKERHUB}:${BASEIMAGE}-${MODNAME}-${DOTNET_TAG}
|
||||||
+39
-3
@@ -1,6 +1,42 @@
|
|||||||
|
FROM lsiobase/alpine:3.12 as buildstage
|
||||||
|
|
||||||
|
ARG DOTNET_VERSIONS
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
apk add --no-cache \
|
||||||
|
curl \
|
||||||
|
jq && \
|
||||||
|
DOTNET_JSON=$(curl -sX GET "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json") && \
|
||||||
|
if [ -z ${DOTNET_VERSIONS+x} ]; then \
|
||||||
|
DOTNET_VERSIONS=$(echo "$DOTNET_JSON" | jq -r '."releases-index"[] | select(."support-phase"=="lts") | ."latest-sdk"' | tr '\n' ' ' | head -c -1); \
|
||||||
|
fi && \
|
||||||
|
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}" && \
|
||||||
|
DOTNET_RELEASE_URL=$(echo "${DOTNET_JSON}" | jq -r ".\"releases-index\"[] | select(.\"latest-sdk\"==\"${i}\") | .\"releases.json\"") && \
|
||||||
|
DOTNET_RELEASE_JSON=$(curl -sX GET "${DOTNET_RELEASE_URL}") && \
|
||||||
|
AMD64_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-x64\")) | .url") && \
|
||||||
|
ARM32_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-arm.\")) | .url") && \
|
||||||
|
ARM64_URL=$(echo "${DOTNET_RELEASE_JSON}" | jq -r ".releases[] | select(.sdk.version==\"${i}\") | .sdk.files[] | select(.name | contains(\"linux-arm64\")) | .url") && \
|
||||||
|
curl -fS --retry 3 --retry-connrefused -o \
|
||||||
|
/root-layer/dotnet/dotnetsdk_"${i}"_x86_64.tar.gz -L \
|
||||||
|
"${AMD64_URL}" && \
|
||||||
|
curl -fS --retry 3 --retry-connrefused -o \
|
||||||
|
/root-layer/dotnet/dotnetsdk_"${i}"_armv7l.tar.gz -L \
|
||||||
|
"${ARM32_URL}" && \
|
||||||
|
curl -fS --retry 3 --retry-connrefused -o \
|
||||||
|
/root-layer/dotnet/dotnetsdk_"${i}"_aarch64.tar.gz -L \
|
||||||
|
"${ARM64_URL}"; \
|
||||||
|
done
|
||||||
|
|
||||||
|
COPY root/ /root-layer/
|
||||||
|
|
||||||
|
# runtime stage
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|
||||||
LABEL maintainer="username"
|
LABEL maintainer="aptalca"
|
||||||
|
|
||||||
# copy local files
|
# Add files from buildstage
|
||||||
COPY root/ /
|
COPY --from=buildstage /root-layer/ /
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
## Buildstage ##
|
|
||||||
FROM lsiobase/alpine:3.9 as buildstage
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
echo "**** install packages ****" && \
|
|
||||||
apk add --no-cache \
|
|
||||||
curl && \
|
|
||||||
echo "**** grab rclone ****" && \
|
|
||||||
mkdir -p /root-layer && \
|
|
||||||
curl -o \
|
|
||||||
/root-layer/rclone.deb -L \
|
|
||||||
"https://downloads.rclone.org/v1.47.0/rclone-v1.47.0-linux-amd64.deb"
|
|
||||||
|
|
||||||
# copy local files
|
|
||||||
COPY root/ /root-layer/
|
|
||||||
|
|
||||||
## Single layer deployed image ##
|
|
||||||
FROM scratch
|
|
||||||
|
|
||||||
# Add files from buildstage
|
|
||||||
COPY --from=buildstage /root-layer/ /
|
|
||||||
@@ -1,17 +1,13 @@
|
|||||||
# Rsync - Docker mod for openssh-server
|
# .NET Core SDK - Docker mod for code server
|
||||||
|
|
||||||
This mod adds rsync to openssh-server, to be installed/updated during container start.
|
This mod adds .NET CORE SDK to code server.
|
||||||
|
|
||||||
In openssh-server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:openssh-server-rsync`
|
In code server docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:code-server-dotnet`
|
||||||
|
|
||||||
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:openssh-server-rsync|linuxserver/mods:openssh-server-mod2`
|
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:code-server-dotnet|linuxserver/mods:code-server-mod2`
|
||||||
|
|
||||||
# Mod creation instructions
|
All current [lts releases](https://dotnet.microsoft.com/download/dotnet-core) will be made available inside the container (3.1.403 and 2.1.811 as of 2020/10/14).
|
||||||
|
|
||||||
* Fork the repo, create a new branch based on the branch `template`.
|
The binaries are accessible at `/dotnet_<sdkversion>/dotnet` for each respective version.
|
||||||
* Edit the `Dockerfile` for the mod. `Dockerfile.complex` is only an example and included for reference; it should be deleted when done.
|
|
||||||
* Inspect the `root` folder contents. Edit, add and remove as necessary.
|
The latest version binary is symlinked from `/usr/local/bin/dotnet` so it can be called via `dotnet` from anywhere.
|
||||||
* Edit this readme with pertinent info, delete these instructions.
|
|
||||||
* Finally edit the `travis.yml`. Customize the build branch, and the vars for `BASEIMAGE` and `MODNAME`.
|
|
||||||
* Ask the team to create a new branch named `<baseimagename>-<modname>`. Baseimage should be the name of the image the mod will be applied to. The new branch will be based on the `template` branch.
|
|
||||||
* Submit PR against the branch created by the team.
|
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
|
# Determine if setup is needed
|
||||||
|
if [ -d /dotnet ]; then
|
||||||
|
# remove existing install if updating
|
||||||
|
if ls -d /dotnet_* >/dev/null 2>&1; then
|
||||||
|
echo "deleting" $(ls -d /dotnet_*)
|
||||||
|
rm -rf /dotnet_*
|
||||||
|
fi
|
||||||
|
DOTNET_VERSIONS=$(cat /dotnet/versions.txt)
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
for i in $DOTNET_VERSIONS; do
|
||||||
|
mkdir -p "/dotnet_${i}"
|
||||||
|
tar xzf "/dotnet/dotnetsdk_${i}_${ARCH}.tar.gz" -C "/dotnet_${i}"
|
||||||
|
done
|
||||||
|
rm -rf /dotnet
|
||||||
|
# symlink latest dotnet binary
|
||||||
|
DOTNET_LATEST=$(echo "$DOTNET_VERSIONS" | awk '{print $1}')
|
||||||
|
rm -rf /usr/local/bin/dotnet
|
||||||
|
ln -s /dotnet_${DOTNET_LATEST}/dotnet /usr/local/bin/dotnet
|
||||||
|
echo "
|
||||||
|
****************************************************
|
||||||
|
****************************************************
|
||||||
|
**
|
||||||
|
**
|
||||||
|
DOTNET SDK versions installed:
|
||||||
|
$(echo $DOTNET_VERSIONS | sed 's| |\n |g')
|
||||||
|
**
|
||||||
|
**
|
||||||
|
Binary locations are:"
|
||||||
|
for i in $DOTNET_VERSIONS; do
|
||||||
|
echo " /dotnet_${i}/dotnet"
|
||||||
|
done
|
||||||
|
echo " **
|
||||||
|
**
|
||||||
|
Version $DOTNET_LATEST is symlinked from /usr/local/bin/dotnet and can be called from anywhere via \"dotnet\"
|
||||||
|
**
|
||||||
|
**
|
||||||
|
****************************************************
|
||||||
|
****************************************************"
|
||||||
|
# symlink other dotnet installs for access through latest binary
|
||||||
|
for i in {2..5}; do
|
||||||
|
DOTNET_OTHER_SDK_VERSION="$(echo $DOTNET_VERSIONS | awk -v var=${i} '{print $var}')"
|
||||||
|
if [ -n "$DOTNET_OTHER_SDK_VERSION" ]; then
|
||||||
|
DOTNET_OTHER_RUNTIME_VERSION="$(ls /dotnet_${DOTNET_OTHER_SDK_VERSION}/shared/Microsoft.NETCore.App)"
|
||||||
|
echo "**** Symlinking sdk version ${DOTNET_OTHER_SDK_VERSION} and runtime version ${DOTNET_OTHER_RUNTIME_VERSION} ****"
|
||||||
|
ln -s "/dotnet_${DOTNET_OTHER_SDK_VERSION}/shared/Microsoft.NETCore.App/${DOTNET_OTHER_RUNTIME_VERSION}" "/dotnet_${DOTNET_LATEST}/shared/Microsoft.NETCore.App/${DOTNET_OTHER_RUNTIME_VERSION}"
|
||||||
|
ln -s "/dotnet_${DOTNET_OTHER_SDK_VERSION}/shared/Microsoft.AspNetCore.App/${DOTNET_OTHER_RUNTIME_VERSION}" "/dotnet_${DOTNET_LATEST}/shared/Microsoft.AspNetCore.App/${DOTNET_OTHER_RUNTIME_VERSION}"
|
||||||
|
ln -s "/dotnet_${DOTNET_OTHER_SDK_VERSION}/sdk/${DOTNET_OTHER_SDK_VERSION}" "/dotnet_${DOTNET_LATEST}/sdk/${DOTNET_OTHER_SDK_VERSION}"
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "**** Existing dotnet install is up to date, skipping ****"
|
||||||
|
fi
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
|
||||||
|
|
||||||
# Determine if setup is needed
|
|
||||||
if [ ! -f /usr/local/lib/python***/dist-packages/sshuttle ] && \
|
|
||||||
[ -f /usr/bin/apt ]; then
|
|
||||||
## Ubuntu
|
|
||||||
apt-get update
|
|
||||||
apt-get install --no-install-recommends -y \
|
|
||||||
iptables \
|
|
||||||
openssh-client \
|
|
||||||
python3 \
|
|
||||||
python3-pip
|
|
||||||
pip3 install sshuttle
|
|
||||||
fi
|
|
||||||
if [ ! -f /usr/lib/python***/site-packages/sshuttle ] && \
|
|
||||||
[ -f /sbin/apk ]; then
|
|
||||||
# Alpine
|
|
||||||
apk add --no-cache \
|
|
||||||
iptables \
|
|
||||||
openssh \
|
|
||||||
py3-pip \
|
|
||||||
python3
|
|
||||||
pip3 install sshuttle
|
|
||||||
fi
|
|
||||||
|
|
||||||
chown -R root:root /root
|
|
||||||
chmod -R 600 /root/.ssh
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
|
||||||
|
|
||||||
sshuttle --dns --remote root@${HOST}:${PORT} 0/0 -x 172.17.0.0/16
|
|
||||||
Reference in New Issue
Block a user