Skip to content

Commit afb9c63

Browse files
committed
update to include ssh in the basic services utils
1 parent 0829937 commit afb9c63

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG TARGETOS=linux
55
ARG TARGETARCH=amd64
66

77
RUN apt-get update -y && \
8-
apt-get install -y --no-install-recommends make rsync && \
8+
apt-get install -y --no-install-recommends make rsync openssh-server ssh && \
99
apt-get clean && \
1010
rm -rf /var/lib/apt/lists/*
1111

cmd/cm-ant/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
// @basePath /ant
2020
func main() {
2121

22-
err := utils.Script(utils.JoinRootPathWith("/script/install_rsync.sh"), []string{})
22+
err := utils.Script(utils.JoinRootPathWith("/script/install_required_utils.sh"), []string{})
2323
if err != nil {
2424
log.Fatal("required tool can not install")
2525
}

script/install_required_utils.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Function to check and install a package
5+
check_and_install() {
6+
PACKAGE_NAME=$1
7+
if command -v $PACKAGE_NAME &>/dev/null; then
8+
echo "$PACKAGE_NAME is already installed."
9+
else
10+
echo "Installing $PACKAGE_NAME..."
11+
apt-get update -y
12+
apt-get install -y $PACKAGE_NAME
13+
fi
14+
}
15+
16+
check_and_install rsync
17+
sleep 1
18+
check_and_install ssh

script/install_rsync.sh

-14
This file was deleted.

0 commit comments

Comments
 (0)