diff --git a/Dockers/remote-react-container/entrypoint.sh b/Dockers/remote-react-container/entrypoint.sh index 0b4c05b..1876040 100644 --- a/Dockers/remote-react-container/entrypoint.sh +++ b/Dockers/remote-react-container/entrypoint.sh @@ -76,6 +76,39 @@ else exit 1 fi + + +# Change to the repository directory +cd /workspace + +# Install dependencies +yarn install + +# Copy the environment file to the repository's environments directory +if [ -f /environment/.dev.env ]; then + mkdir -p /workspace/environments + cp /environment/.dev.env /workspace/environments/.dev.env +fi + +# Set the git user and email +git config --global user.name "$GIT_USER" +git config --global user.email "$GIT_EMAIL" + +# Get the hostname of the machine +HOSTNAME=$(hostname) + +# 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" +fi + +# File path +CONFIG_FILE="/etc/teleport.yaml" + +# Edit the teleport.yaml file to update the nodename +sed -i "s/^ nodename:.*/ nodename: $HOSTNAME/" "$CONFIG_FILE" + # Function to add labels to teleport.yaml # Function to add labels to teleport.yaml add_teleport_labels() { @@ -156,37 +189,6 @@ add_teleport_labels() { # Add labels to teleport configuration add_teleport_labels -# Change to the repository directory -cd /workspace - -# Install dependencies -yarn install - -# Copy the environment file to the repository's environments directory -if [ -f /environment/.dev.env ]; then - mkdir -p /workspace/environments - cp /environment/.dev.env /workspace/environments/.dev.env -fi - -# Set the git user and email -git config --global user.name "$GIT_USER" -git config --global user.email "$GIT_EMAIL" - -# Get the hostname of the machine -HOSTNAME=$(hostname) - -# 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" -fi - -# File path -CONFIG_FILE="/etc/teleport.yaml" - -# Edit the teleport.yaml file to update the nodename -sed -i "s/^ nodename:.*/ nodename: $HOSTNAME/" "$CONFIG_FILE" - # Start Teleport in the background nohup teleport start &