diff --git a/codes/Dockerfile b/codes/Dockerfile index 401da5d28..1e4a57523 100644 --- a/codes/Dockerfile +++ b/codes/Dockerfile @@ -5,13 +5,10 @@ RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \ sed -i 's/ports.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list -RUN apt-get update +RUN apt-get update && apt-get install -y wget -# 设置需要安装的语言,使用空格隔开 -# Set the languages to be installed, separated by spaces -ARG LANGS="python cpp" - -# Available languages:python cpp java +# Install languages environment +ARG LANGS RUN for LANG in $LANGS; do \ case "$LANG" in \ python) \ @@ -21,6 +18,11 @@ RUN for LANG in $LANGS; do \ apt-get install -y g++ gdb ;; \ java) \ apt-get install -y openjdk-17-jdk ;; \ + csharp) \ + wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \ + dpkg -i packages-microsoft-prod.deb && \ + apt-get update && \ + apt-get install -y dotnet-sdk-6.0 ;; \ # More languages... *) \ echo "Warning: No installation workflow for $LANG" ;; \ diff --git a/codes/docker-compose.yml b/codes/docker-compose.yml index ccfde7ee3..e003ab034 100644 --- a/codes/docker-compose.yml +++ b/codes/docker-compose.yml @@ -1,7 +1,12 @@ version: '3.8' services: hello-algo-code: - build: . + build: + context: . + args: + # 设置需要安装的语言,使用空格隔开 + # Set the languages to be installed, separated by spaces + LANGS: "python cpp csharp" image: hello-algo-code container_name: hello-algo-code stdin_open: true