Skip to content

Instantly share code, notes, and snippets.

@devtronic
Created March 7, 2026 10:46
Show Gist options
  • Select an option

  • Save devtronic/5c80ae9db542938440c172f8e411f7dd to your computer and use it in GitHub Desktop.

Select an option

Save devtronic/5c80ae9db542938440c172f8e411f7dd to your computer and use it in GitHub Desktop.
Docker dotnet with Rider Debugging
#!/usr/bin/env bash
set -euo pipefail
### This script installs the remote debug tools from jetbrains based on the host architecture
apt-get update \
&& apt-get install -y --no-install-recommends unzip \
&& apt-get upgrade -y \
&& apt-get clean autoclean \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/apt/ \
&& rm -rf /var/lib/cache/ \
&& rm -rf /var/lib/dpkg/ \
&& rm -rf /var/lib/lists/ \
&& rm -rf /var/lib/log/ \
&& rm -rf /share/doc/;
BASE_URL="https://data.services.jetbrains.com/products/download?code=RRD"
detect_arch() {
case "$(uname -m)" in
x86_64|amd64)
echo "x64"
;;
aarch64|arm64)
echo "arm64"
;;
armv7*|armv6*|arm)
echo "arm32"
;;
*)
echo "Unsupported architecture: $(uname -m)"
exit 1
;;
esac
}
detect_libc() {
if ldd --version 2>&1 | grep -qi musl; then
echo "musl"
else
echo "glibc"
fi
}
ARCH=$(detect_arch)
LIBC=$(detect_libc)
case "$ARCH-$LIBC" in
x64-glibc)
PLATFORM="linux64"
;;
x64-musl)
PLATFORM="linuxMuslX64"
;;
arm64-glibc)
PLATFORM="linuxARM64"
;;
arm64-musl)
PLATFORM="linuxMuslARM64"
;;
arm32-glibc)
PLATFORM="linuxARM32"
;;
arm32-musl)
PLATFORM="linuxMuslARM32"
;;
*)
echo "Unsupported platform combination: $ARCH-$LIBC"
exit 1
;;
esac
URL="$BASE_URL&platform=$PLATFORM"
echo "Detected architecture: $ARCH"
echo "Detected libc: $LIBC"
echo "Downloading: $URL"
real_url=$(curl -Ls -o /dev/null -w '%{url_effective}' $URL)
curl -L "$real_url" -o debugger.zip
shopt -s nullglob
echo "Download complete: debugger.zip"
mkdir -p "./root/.RiderDebuggerTools"
unzip -d "./root/.RiderDebuggerTools" debugger.zip
rm debugger.zip
rm /tmp/dev.sh
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS dev
COPY --chmod=777 dev.sh /tmp/dev.sh
RUN /tmp/dev.sh
ENV ASPNETCORE_ENVIRONMENT=Development
ENV ASPNETCORE_URLS=http://+:8080
ENV DOTNET_USE_POLLING_FILE_WATCHER=1
WORKDIR /app
CMD dotnet watch run --project path/to.csproj --verbosity diag --urls http://*:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment