Skip to content

Instantly share code, notes, and snippets.

@kshyju
Created November 13, 2024 19:06
Show Gist options
  • Save kshyju/39d9e5762154ae9d42b54f0f42685427 to your computer and use it in GitHub Desktop.
Save kshyju/39d9e5762154ae9d42b54f0f42685427 to your computer and use it in GitHub Desktop.
Ubuntu 20.04 With .NET9 SDK
# Use Ubuntu 20.04 as the base image
FROM ubuntu:20.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
# Install essential packages and dependencies
RUN apt-get update && \
apt-get install -y \
wget \
apt-transport-https \
software-properties-common && \
# Add Microsoft package signing key and package repository
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
rm packages-microsoft-prod.deb && \
# Update package list and install .NET SDK
apt-get update && \
apt-get install -y dotnet-sdk-9.0 && \
# Clean up
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Verify the installation
RUN dotnet --version
# Set working directory
WORKDIR /app
# Default command
CMD ["dotnet", "--help"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment