python c++ c

This commit is contained in:
krahets 2023-12-01 20:47:19 +08:00
parent b824d149cb
commit e3fcf37afe
3 changed files with 23 additions and 11 deletions

View file

@ -5,31 +5,33 @@ 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/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 sed -i 's/ports.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN apt-get update && apt-get install -y wget
# Install languages environment # Install languages environment
ARG LANGS ARG LANGS
RUN for LANG in $LANGS; do \ RUN for LANG in $LANGS; do \
case $LANG in \ case $LANG in \
python) \ python) \
apt-get install -y python3.10 && \ apt-get update && apt-get install -y python3.10 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 ;; \ update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 ;; \
cpp) \ cpp) \
apt-get install -y g++ gdb ;; \ apt-get update && apt-get install -y g++ gdb ;; \
java) \ java) \
apt-get install -y openjdk-17-jdk ;; \ apt-get update && apt-get install -y openjdk-17-jdk ;; \
csharp) \ csharp) \
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \ apt-get update && apt-get install -y wget && \
dpkg -i packages-microsoft-prod.deb && \ wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \
apt-get update && \ chmod +x ./dotnet-install.sh && \
apt-get install -y dotnet-sdk-8.0 ;; \ ./dotnet-install.sh --channel 8.0 && \
apt-get install libicu-dev ;; \
c) \
apt-get update && apt-get install -y gcc gdb ;; \
# More languages... # More languages...
*) \ *) \
echo "Warning: No installation workflow for $LANG" ;; \ echo "Warning: No installation workflow for $LANG" ;; \
esac \ esac \
done done
RUN rm -rf /var/lib/apt/lists/*
WORKDIR /codes WORKDIR /codes
COPY ./ ./
CMD ["/bin/bash"] CMD ["/bin/bash"]

8
codes/devcontainer.json Normal file
View file

@ -0,0 +1,8 @@
{
"name": "hello-algo-code",
"extensions": [
"ms-python.python",
"ms-vscode.cpptools",
// List other extensions you want
]
}

View file

@ -6,8 +6,10 @@ services:
args: args:
# 设置需要安装的语言,使用空格隔开 # 设置需要安装的语言,使用空格隔开
# Set the languages to be installed, separated by spaces # Set the languages to be installed, separated by spaces
LANGS: "python cpp java csharp" LANGS: "python cpp c"
image: hello-algo-code image: hello-algo-code
container_name: hello-algo-code container_name: hello-algo-code
volumes:
- .:/codes
stdin_open: true stdin_open: true
tty: true tty: true