diff options
-rw-r--r-- | docker/debian-dev/Dockerfile | 7 | ||||
-rwxr-xr-x | docker/debian-dev/bootstrap/apt-source/get-domain.bash | 1 | ||||
-rwxr-xr-x | docker/debian-dev/bootstrap/apt-source/setup.bash | 5 | ||||
-rwxr-xr-x | docker/debian-dev/bootstrap/setup-user.bash | 9 | ||||
-rwxr-xr-x | docker/debian-dev/bootstrap/setup.bash | 1 |
5 files changed, 17 insertions, 6 deletions
diff --git a/docker/debian-dev/Dockerfile b/docker/debian-dev/Dockerfile index 83e5717..ce0b10c 100644 --- a/docker/debian-dev/Dockerfile +++ b/docker/debian-dev/Dockerfile @@ -1,8 +1,10 @@ FROM debian:11 +ARG USERNAME= ARG IN_CHINA= ARG SETUP_SBUILD= +ENV USERNAME=${USERNAME} ENV IN_CHINA=${IN_CHINA} ENV SETUP_SBUILD=${SETUP_SBUILD} @@ -10,6 +12,7 @@ ADD bootstrap /bootstrap RUN /bootstrap/setup.bash -VOLUME [ "/source", "/data" ] -CMD [ "bash", "-l" ] +USER ${USERNAME} +VOLUME [ "/source", "/data", "/share" ] +CMD [ "bash", "-l" ] diff --git a/docker/debian-dev/bootstrap/apt-source/get-domain.bash b/docker/debian-dev/bootstrap/apt-source/get-domain.bash index c9b93b1..d44ea65 100755 --- a/docker/debian-dev/bootstrap/apt-source/get-domain.bash +++ b/docker/debian-dev/bootstrap/apt-source/get-domain.bash @@ -3,4 +3,3 @@ set -e sed "s|.*https\?://\([-_.a-zA-Z0-9]\+\)/.*|\\1|;q" /etc/apt/sources.list - diff --git a/docker/debian-dev/bootstrap/apt-source/setup.bash b/docker/debian-dev/bootstrap/apt-source/setup.bash index 36065f6..60e635b 100755 --- a/docker/debian-dev/bootstrap/apt-source/setup.bash +++ b/docker/debian-dev/bootstrap/apt-source/setup.bash @@ -2,12 +2,11 @@ set -e -dir=$(dirname $0) +dir=$(dirname "$0") if [[ -n $IN_CHINA ]]; then - "$dir/replace-domain.bash" $(cat "$dir/china-source.txt") + "$dir/replace-domain.bash" "$(cat "$dir/china-source.txt")" fi "$dir/install-apt-https.bash" "$dir/replace-http.bash" - diff --git a/docker/debian-dev/bootstrap/setup-user.bash b/docker/debian-dev/bootstrap/setup-user.bash new file mode 100755 index 0000000..0eccde4 --- /dev/null +++ b/docker/debian-dev/bootstrap/setup-user.bash @@ -0,0 +1,9 @@ +#! /usr/bin/env bash + +set -e + +apt-get install -y sudo + +sed -i.bak 's|%sudo[[:space:]]\+ALL=(ALL:ALL)[[:space:]]\+ALL|%sudo ALL=(ALL:ALL) NOPASSWD: ALL|' /etc/sudoers + +useradd -m -G sudo -s /usr/bin/bash "$USERNAME" diff --git a/docker/debian-dev/bootstrap/setup.bash b/docker/debian-dev/bootstrap/setup.bash index 2aa88e0..c72db87 100755 --- a/docker/debian-dev/bootstrap/setup.bash +++ b/docker/debian-dev/bootstrap/setup.bash @@ -5,6 +5,7 @@ set -e export DEBIAN_FRONTEND=noninteractive /bootstrap/apt-source/setup.bash +/bootstrap/setup-user.bash /bootstrap/setup-base.bash /bootstrap/setup-dev.bash |