homeserver/devspace.sh

36 lines
913 B
Bash
Raw Normal View History

2024-07-25 23:33:28 +02:00
#!/bin/bash
2024-07-25 23:36:08 +02:00
IMAGE="registry.mgrote.net/ansible-devspace:latest"
2024-07-25 23:33:28 +02:00
# Farben
2024-07-25 23:36:08 +02:00
# https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
2024-07-25 23:36:55 +02:00
RESET='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
2024-07-29 16:16:41 +02:00
YELLOW='\033[0;33m'
2024-07-25 23:33:28 +02:00
2024-07-25 23:49:19 +02:00
echo -e "${GREEN}Run checks...${RESET}"
2024-07-25 23:33:28 +02:00
if ! [ -f "./vault-pass" ]; then
2024-07-25 23:38:57 +02:00
echo -e "${RED}Vault-Pass File is missing!${RESET}"
2024-07-25 23:33:28 +02:00
exit 1
fi
if ! [ -f "./id_ed25519" ]; then
2024-07-25 23:38:57 +02:00
echo -e "${RED}SSH-Private-Key is missing!${RESET}"
2024-07-25 23:33:28 +02:00
exit 1
fi
2024-07-30 11:44:07 +02:00
if ! [ -f "$HOME/.git-credentials" ]; then
2024-07-30 10:50:43 +02:00
echo -e "${YELLOW}~/.git-credentials not found!${RESET}"
2024-07-29 16:13:57 +02:00
fi
2024-07-30 11:44:48 +02:00
if ! [[ $(id -u) -eq "1000" ]]; then
2024-07-30 11:44:07 +02:00
echo -e "${RED}Wrong UID (!=1000)${RESET}"
exit 1
fi
2024-07-25 23:33:28 +02:00
2024-07-26 00:42:22 +02:00
docker pull ${IMAGE}
2024-07-25 23:33:28 +02:00
2024-07-25 23:45:23 +02:00
docker run -it \
2024-07-30 11:10:43 +02:00
-v "$PWD:/home/ansible-dev/ansible-homeserver" \
2024-07-30 11:16:39 +02:00
-v "$HOME/.git-credentials:/home/ansible-dev/.git-credentials" \
2024-07-30 11:35:36 +02:00
-w /home/ansible-dev/ansible-homeserver ${IMAGE}