homeserver/devspace.sh
Michael Grote bb6f7d1853
Some checks failed
ci/woodpecker/push/gitleaks Pipeline was successful
ci/woodpecker/push/ansible-lint Pipeline failed
CI + Dev-Workspace: disable automatic rollout and setup new Workspace (#145)
Reviewed-on: #145
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Co-committed-by: Michael Grote <michael.grote@posteo.de>
2024-07-30 20:58:24 +02:00

38 lines
999 B
Bash
Executable file

#!/bin/bash
IMAGE="registry.mgrote.net/ansible-devspace:latest"
# Farben
# https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
RESET='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
echo -e "${GREEN}Run checks...${RESET}"
if ! [ -f "./vault-pass" ]; then
echo -e "${RED}Vault-Pass File is missing!${RESET}"
exit 1
fi
if ! [ -f "./id_ed25519" ]; then
echo -e "${RED}SSH-Private-Key is missing!${RESET}"
exit 1
fi
if ! [ -f "$HOME/.git-credentials" ]; then
echo -e "${YELLOW}~/.git-credentials not found!${RESET}"
fi
if ! [[ $(id -u) -eq "1000" ]]; then
echo -e "${RED}Wrong UID! (!=1000)${RESET}"
exit 1
fi
echo -e "${GREEN}Pull Image...${RESET}"
docker pull ${IMAGE}
echo -e "${GREEN}Start container...${RESET}"
docker run -it \
-v "$PWD:/home/ansible-dev/ansible-homeserver" \
-v "$HOME/.git-credentials:/home/ansible-dev/.git-credentials" \
-w /home/ansible-dev/ansible-homeserver ${IMAGE}