diff options
| author | crupest <crupest@outlook.com> | 2024-08-14 00:28:12 +0800 | 
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2024-08-14 11:28:11 +0800 | 
| commit | b92f69c4b985f3ac3d33d21d76a6b7c951cb3446 (patch) | |
| tree | 027ac0f97891993b1deac6569d7b26730378ddf6 | |
| parent | 18e9bb5c63702be90076b6225eb4a9781f4fb088 (diff) | |
| download | crupest-b92f69c4b985f3ac3d33d21d76a6b7c951cb3446.tar.gz crupest-b92f69c4b985f3ac3d33d21d76a6b7c951cb3446.tar.bz2 crupest-b92f69c4b985f3ac3d33d21d76a6b7c951cb3446.zip | |
feat(docker/debian-dev): add more output, rename vars and fix some bugs.
9 files changed, 67 insertions, 13 deletions
| diff --git a/docker/crupest-debian-dev/Dockerfile b/docker/crupest-debian-dev/Dockerfile index a92ea4f..f7933a7 100644 --- a/docker/crupest-debian-dev/Dockerfile +++ b/docker/crupest-debian-dev/Dockerfile @@ -1,19 +1,19 @@  FROM debian:latest -ARG USERNAME=crupest +ARG USER=crupest  ARG IN_CHINA= -ARG SETUP_CODE_SERVER=true +ARG CODE_SERVER=true -ENV USERNAME=${USERNAME} -ENV IN_CHINA=${IN_CHINA} -ENV SETUP_CODE_SERVER=${SETUP_CODE_SERVER} +ENV CRUPEST_DEBIAN_DEV_USER=${USER} +ENV CRUPEST_DEBIAN_DEV_IN_CHINA=${IN_CHINA} +ENV CRUPEST_DEBIAN_DEV_SETUP_CODE_SERVER=${CODE_SERVER}  ADD bootstrap /bootstrap -ENV LANG=en_US.utf8  RUN /bootstrap/setup.bash +ENV LANG=en_US.utf8 -USER ${USERNAME} +USER ${USER}  EXPOSE 8080  VOLUME [ "/data" ] diff --git a/docker/crupest-debian-dev/bootstrap/apt-source/install-apt-https.bash b/docker/crupest-debian-dev/bootstrap/apt-source/install-apt-https.bash index 05d372b..70fb371 100755 --- a/docker/crupest-debian-dev/bootstrap/apt-source/install-apt-https.bash +++ b/docker/crupest-debian-dev/bootstrap/apt-source/install-apt-https.bash @@ -4,4 +4,5 @@ set -e  echo "Install apt https transport."  apt-get update +apt-get install -y apt-utils  apt-get install -y apt-transport-https ca-certificates diff --git a/docker/crupest-debian-dev/bootstrap/apt-source/setup.bash b/docker/crupest-debian-dev/bootstrap/apt-source/setup.bash index 60e635b..60583d4 100755 --- a/docker/crupest-debian-dev/bootstrap/apt-source/setup.bash +++ b/docker/crupest-debian-dev/bootstrap/apt-source/setup.bash @@ -4,9 +4,14 @@ set -e  dir=$(dirname "$0") -if [[ -n $IN_CHINA ]]; then +echo "Setting up apt source..." + +if [[ -n $CRUPEST_DEBIAN_DEV_IN_CHINA ]]; then +    echo "In China, using China source..."      "$dir/replace-domain.bash" "$(cat "$dir/china-source.txt")"  fi  "$dir/install-apt-https.bash"  "$dir/replace-http.bash" + +echo "Setting up apt source done." diff --git a/docker/crupest-debian-dev/bootstrap/bash-profile/code-server.bash b/docker/crupest-debian-dev/bootstrap/bash-profile/code-server.bash index 443eb0b..e683e76 100644 --- a/docker/crupest-debian-dev/bootstrap/bash-profile/code-server.bash +++ b/docker/crupest-debian-dev/bootstrap/bash-profile/code-server.bash @@ -6,7 +6,7 @@ CODE_SERVER_PORT=8080  if which "$CODE_SERVER_PROGRAM" > /dev/null 2>&1; then      if ! pgrep -f "$CODE_SERVER_PROGRAM" > /dev/null 2>&1; then          mkdir -p ~/.local/share/code-server -        nohup "$CODE_SERVER_PROGRAM" "--bind-addr", "0.0.0.0:$CODE_SERVER_PORT" \ +        "$CODE_SERVER_PROGRAM" "--bind-addr", "0.0.0.0:$CODE_SERVER_PORT" \              > ~/.local/share/code-server/log  2> ~/.local/share/code-server/error &      fi  fi diff --git a/docker/crupest-debian-dev/bootstrap/setup-base.bash b/docker/crupest-debian-dev/bootstrap/setup-base.bash index 060daeb..e918a8b 100755 --- a/docker/crupest-debian-dev/bootstrap/setup-base.bash +++ b/docker/crupest-debian-dev/bootstrap/setup-base.bash @@ -4,8 +4,17 @@ set -e  . /bootstrap/func.bash +echo "Setting up basic system function..." + +echo "Installing basic packages..." +apt-get install -y apt-utils  apt-get install -y locales procps vim less man bash-completion rsync curl wget +echo "Installing basic packages done." +echo "Setting up locale..."  localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +echo "Setting up locale done."  append-bash-profile bash-completion.bash + +echo "Setting up basic system function done." diff --git a/docker/crupest-debian-dev/bootstrap/setup-code-server.bash b/docker/crupest-debian-dev/bootstrap/setup-code-server.bash index cb9a407..922a88d 100755 --- a/docker/crupest-debian-dev/bootstrap/setup-code-server.bash +++ b/docker/crupest-debian-dev/bootstrap/setup-code-server.bash @@ -4,11 +4,25 @@ set -e  . /bootstrap/func.bash +echo "Setting up code server..." + +echo "Get latest version of code-server..."  VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') -url="https://github.com/coder/code-server/releases/download/v${VERSION}/code-server_${VERSION}_amd64.deb" +echo "Current latest version of code-server is $VERSION" +echo "Downloading code-server..." +url="https://github.com/coder/code-server/releases/download/v${VERSION}/code-server_${VERSION}_amd64.deb"  curl -sSfOL "$url" +echo "Downloading code-server done." + +echo "Installing code-server..."  apt install "./code-server_${VERSION}_amd64.deb" +echo "Installing code-server done." + +echo "Cleaning up deb..."  rm "code-server_${VERSION}_amd64.deb" +echo "Cleaning up deb done."  append-bash-profile code-server.bash + +echo "Setting up code server done." diff --git a/docker/crupest-debian-dev/bootstrap/setup-dev.bash b/docker/crupest-debian-dev/bootstrap/setup-dev.bash index 8d26328..9e2c6de 100755 --- a/docker/crupest-debian-dev/bootstrap/setup-dev.bash +++ b/docker/crupest-debian-dev/bootstrap/setup-dev.bash @@ -4,9 +4,15 @@ set -e  . /bootstrap/func.bash +echo "Setting up dev function..." + +echo "Installing dev packages..."  apt-get install -y build-essential git devscripts debhelper quilt \      cpio kmod bc python3 bison flex libelf-dev libssl-dev libncurses-dev dwarves +echo "Installing dev packages done."  append-bash-profile dquilt.bash  copy-home-dot-file devscripts  copy-home-dot-file quiltrc-dpkg + +echo "Setting up dev function done." diff --git a/docker/crupest-debian-dev/bootstrap/setup-user.bash b/docker/crupest-debian-dev/bootstrap/setup-user.bash index 0eccde4..f74dcdb 100755 --- a/docker/crupest-debian-dev/bootstrap/setup-user.bash +++ b/docker/crupest-debian-dev/bootstrap/setup-user.bash @@ -2,8 +2,19 @@  set -e +echo "Setting up user..." + +echo "Installing sudo..."  apt-get install -y sudo +echo "Installing sudo done." +echo "Setting up sudo..."  sed -i.bak 's|%sudo[[:space:]]\+ALL=(ALL:ALL)[[:space:]]\+ALL|%sudo ALL=(ALL:ALL) NOPASSWD: ALL|' /etc/sudoers +echo "Setting up sudo done." + +echo "Adding user $CRUPEST_DEBIAN_DEV_USER ..." +useradd -m -G sudo -s /usr/bin/bash "$CRUPEST_DEBIAN_DEV_USER" +echo "Adding user done." + +echo "Setting up user done." -useradd -m -G sudo -s /usr/bin/bash "$USERNAME" diff --git a/docker/crupest-debian-dev/bootstrap/setup.bash b/docker/crupest-debian-dev/bootstrap/setup.bash index 1aaff50..09b8137 100755 --- a/docker/crupest-debian-dev/bootstrap/setup.bash +++ b/docker/crupest-debian-dev/bootstrap/setup.bash @@ -4,19 +4,27 @@ set -e  export DEBIAN_FRONTEND=noninteractive +echo "Setting up crupest-debian-dev..." +  . /bootstrap/func.bash  /bootstrap/apt-source/setup.bash +echo "Updating apt source index..."  apt-get update +echo "Updating apt source index done."  /bootstrap/setup-user.bash  /bootstrap/setup-base.bash  /bootstrap/setup-dev.bash -if is_true "$SETUP_CODE_SERVER"; then +if is_true "$CRUPEST_DEBIAN_DEV_SETUP_CODE_SERVER"; then +    echo "CRUPEST_DEBIAN_DEV_SETUP_CODE_SERVER is true, setting up code-server..."      /bootstrap/setup-code-server.bash  fi - +echo "Cleaning up apt source index..."  rm -rf /var/lib/apt/lists/* +echo "Cleaning up apt source index done." + +echo "Setting up crupest-debian-dev done." | 
