This commit is contained in:
@@ -8,7 +8,15 @@ WORKDIR /workspace
|
||||
RUN npm install -g pm2
|
||||
|
||||
# Install git, openssh-client, openssh-server, and other necessary packages
|
||||
RUN apt-get update && apt-get install -y git openssh-client openssh-server software-properties-common sudo
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
openssh-client \
|
||||
openssh-server \
|
||||
software-properties-common \
|
||||
sudo \
|
||||
curl \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install additional package managers
|
||||
RUN npm install -g pnpm
|
||||
|
||||
@@ -39,21 +39,34 @@ fi
|
||||
# Set default package manager if not provided
|
||||
PACKAGE_MANAGER=${PACKAGE_MANAGER:-npm}
|
||||
|
||||
# If no teleport edition is given, fallback to oss
|
||||
TELEPORT_EDITION=${TELEPORT_EDITION:-oss}
|
||||
# Optional Teleport setup
|
||||
if [ -n "$TELEPORT_VERSION" ] && [ -n "$TELEPORT_URL" ] && [ -n "$TELEPORT_TOKEN" ]; then
|
||||
echo "Teleport configuration detected. Setting up Teleport..."
|
||||
|
||||
# Install Teleport if the environment variables are set
|
||||
if [ -n "$TELEPORT_VERSION" ] && [ -n "$TELEPORT_URL" ]; then
|
||||
echo "Installing Teleport version $TELEPORT_VERSION, edition $TELEPORT_EDITION..."
|
||||
curl https://goteleport.com/static/install.sh | bash -s "${TELEPORT_VERSION}" "${TELEPORT_EDITION}"
|
||||
# Set default edition if not provided
|
||||
TELEPORT_EDITION=${TELEPORT_EDITION:-oss}
|
||||
|
||||
# If teleport token is set and there is no teleport.yaml file, create one
|
||||
if [ -n "$TELEPORT_TOKEN" ] && [ ! -f /etc/teleport.yaml ]; then
|
||||
teleport configure --roles=node --token="$TELEPORT_TOKEN" --proxy="$TELEPORT_URL" --no-acme -o file
|
||||
echo "Created teleport configuration file"
|
||||
# Only install Teleport if it's not already installed
|
||||
if ! command -v teleport &> /dev/null; then
|
||||
echo "Installing Teleport version $TELEPORT_VERSION, edition $TELEPORT_EDITION..."
|
||||
curl https://goteleport.com/static/install.sh | bash -s "${TELEPORT_VERSION}" "${TELEPORT_EDITION}"
|
||||
fi
|
||||
|
||||
# Create teleport configuration
|
||||
teleport configure --roles=node --token="$TELEPORT_TOKEN" --proxy="$TELEPORT_URL" --no-acme -o file
|
||||
echo "Created teleport configuration file"
|
||||
|
||||
# Get the hostname of the machine
|
||||
HOSTNAME=$(hostname)
|
||||
|
||||
# Update nodename in teleport config
|
||||
sed -i "s/^ nodename:.*/ nodename: $HOSTNAME/" /etc/teleport.yaml
|
||||
|
||||
# Start Teleport in the background
|
||||
echo "Starting Teleport service..."
|
||||
nohup teleport start &
|
||||
else
|
||||
echo "Warning: TELEPORT_VERSION and TELEPORT_URL environment variables are not set. Skipping Teleport installation."
|
||||
echo "Skipping Teleport setup - credentials not provided"
|
||||
fi
|
||||
|
||||
# Ensure the SSH key has the correct permissions
|
||||
@@ -114,22 +127,6 @@ fi
|
||||
git config --global user.name "$GIT_USER"
|
||||
git config --global user.email "$GIT_EMAIL"
|
||||
|
||||
# Get the hostname of the machine
|
||||
HOSTNAME=$(hostname)
|
||||
|
||||
# File path
|
||||
CONFIG_FILE="/etc/teleport.yaml"
|
||||
|
||||
# Edit the teleport.yaml file to update the nodename if the file exists
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
sed -i "s/^ nodename:.*/ nodename: $HOSTNAME/" "$CONFIG_FILE"
|
||||
|
||||
# Start Teleport in the background
|
||||
nohup teleport start &
|
||||
else
|
||||
echo "Warning: Teleport configuration file not found. Skipping Teleport start."
|
||||
fi
|
||||
|
||||
# Start SSH server
|
||||
service ssh start
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.0
|
||||
3.1
|
||||
Reference in New Issue
Block a user