init
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
FROM golang:1.24
|
||||
RUN git clone https://github.com/iceBear67/bubble && cd bubble/ && bash ./build.sh
|
||||
|
||||
FROM debian:11
|
||||
COPY --from=0 /bubble/src/target/client /bin/bubble
|
||||
RUN <<EOF
|
||||
apt-get update && apt-get upgrade
|
||||
apt-get install -y curl jq neovim htop fish tmux sudo git
|
||||
useradd -m -s /bin/fish user
|
||||
echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user.conf
|
||||
EOF
|
||||
COPY ./init.fish /home/user/.init.fish
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
if ! cat /etc/passwd | grep -E "^user"
|
||||
echo "User was not created correctly. Creating user..."
|
||||
useradd -m -s /bin/fish user
|
||||
if test ! -e /etc/sudoers.d/user.conf
|
||||
echo "Setting sudo permissions"
|
||||
mkdir -p /etc/sudoers.d/
|
||||
echo "user ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/user.conf
|
||||
end
|
||||
echo "Due to abnormal user creation, auto configuration guide is not available in this setup."
|
||||
echo "Try 'bubble destroy' for a new container if needed."
|
||||
end
|
||||
|
||||
function resume
|
||||
if sudo -u user tmux has-session -t 0
|
||||
if sudo -u user tmux ls | grep -E "^0.*attached)"
|
||||
echo "The default tmux session has been attached, dropping you to a normal shell."
|
||||
cd /home/user && sudo -u user /bin/fish
|
||||
else
|
||||
sudo -u user tmux attach -t 0
|
||||
end
|
||||
else
|
||||
sudo -u user tmux new-session -c /home/user /bin/fish
|
||||
end
|
||||
end
|
||||
|
||||
resume
|
||||
@@ -0,0 +1,28 @@
|
||||
function install-docker
|
||||
if test -e /bin/docker
|
||||
echo "Docker is already present at /bin/docker."
|
||||
return
|
||||
end
|
||||
echo "Installing docker in 3s."
|
||||
sleep 3s
|
||||
echo "[DOCKER] Updating software registry."
|
||||
sudo apt-get update
|
||||
sudo apt-get install ca-certificates
|
||||
echo "[DOCKER] Updating package manager keyrings"
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
echo "[DOCKER] Adding trust for docker repository"
|
||||
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||
echo "[DOCKER] Adding docker repository"
|
||||
bash -c 'echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
|
||||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null'
|
||||
sudo apt-get update
|
||||
echo "[DOCKER] Installing docker"
|
||||
if sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
echo "[DOCKER] Docker should be installed successfully"
|
||||
else
|
||||
echo "Unexpected error."
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user