-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (31 loc) · 1.09 KB
/
Dockerfile
File metadata and controls
38 lines (31 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
ARG UBUNTU_VERSION=22.04
FROM ubuntu:${UBUNTU_VERSION}
RUN apt-get update
RUN apt-get install -y sudo
RUN useradd -ms /bin/bash -G sudo zegan
RUN usermod -aG root zegan
RUN usermod -aG sudo zegan
RUN echo "zegan ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER zegan
ENV USER=zegan
WORKDIR /home/zegan
ARG IN_CHINA=false
# Ubuntu 24.04+ 使用 deb822 格式 (sources.list.d/*.sources)
# 旧版本使用传统 sources.list 格式
RUN \
if ${IN_CHINA}; \
then \
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then \
sudo sed -i 's|URIs: http://archive.ubuntu.com/ubuntu/|URIs: http://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list.d/ubuntu.sources; \
elif [ -f /etc/apt/sources.list ]; then \
sudo sed -i 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//http:\/\/mirrors\.aliyun\.com\/ubuntu\//g' /etc/apt/sources.list; \
fi; \
fi
# 安装环境
ADD ubuntu-init.sh /usr/bin/ubuntu-init
ADD conf/ /usr/share/linux-config/conf/
RUN \
bash ubuntu-init --local /usr/share/linux-config/conf; \
bash ubuntu-init --local /usr/share/linux-config/conf dev;
CMD \
zsh