modification script lancement
This commit is contained in:
parent
05d471f475
commit
795340a75c
@ -5,6 +5,7 @@ USER root
|
||||
RUN apk add openconnect shadow --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
|
||||
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
COPY settings.json /settings.json
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=10s --start-period=10s \
|
||||
CMD /sbin/ifconfig tun0
|
||||
|
@ -20,7 +20,7 @@ services:
|
||||
expose:
|
||||
- "3000"
|
||||
volumes:
|
||||
- "$VOLUME:/home/project:cached"
|
||||
VOLUMES_WRAPPER
|
||||
- ~/.ssh:/home/.ssh:ro
|
||||
init: true
|
||||
environment:
|
@ -8,11 +8,11 @@ id_node=$(id -u node)
|
||||
if [ $id_node != ${USER_ID} ]; then
|
||||
if [ -z ${GROUPE_ID} ]; then
|
||||
echo "Création de l'utilisateur giref avec uid=${USER_ID}"
|
||||
adduser -u ${USER_ID} -h /home/giref/ -s /bin/bash -D giref;
|
||||
adduser -u ${USER_ID} -h /home/giref/ -s /bin/bash -D giref
|
||||
else
|
||||
echo "Création de l'utilisateur giref avec uid=${USER_ID} dans le groupe giref avec gid=${GROUPE_ID}"
|
||||
addgroup -g ${GROUPE_ID} giref
|
||||
adduser -u ${USER_ID} -G giref -h /home/giref/ -s /bin/bash -D giref;
|
||||
adduser -u ${USER_ID} -G giref -h /home/giref/ -s /bin/bash -D giref
|
||||
fi
|
||||
user=giref
|
||||
else
|
||||
@ -28,6 +28,13 @@ if [ -d /home/.ssh ]; then
|
||||
chown -R $user:$user /home/$user/.ssh
|
||||
fi
|
||||
|
||||
# settings pour theia
|
||||
if [ -f /settings.json ]; then
|
||||
mkdir -p /home/$user/.theia
|
||||
cp /settings.json /home/$user/.theia
|
||||
chown -R $user:$user /home/$user/.theia
|
||||
fi
|
||||
|
||||
# Enfin, reprend le entrypoint donné ici : https://github.com/theia-ide/theia-apps/blob/master/theia-docker/Dockerfile
|
||||
echo "Lancement de theia..."
|
||||
su $user bash -c "/usr/local/bin/node /home/theia/src-gen/backend/main.js /home/project --hostname=0.0.0.0"
|
||||
|
6
settings.json
Normal file
6
settings.json
Normal file
@ -0,0 +1,6 @@
|
||||
// à copier dans /home/giref/.theia/
|
||||
{
|
||||
"workbench.iconTheme": "theia-file-icons",
|
||||
"editor.fontSize": 18,
|
||||
"editor.mouseWheelScrollSensitivity": 10
|
||||
}
|
27
wrapper.sh
27
wrapper.sh
@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
command -v docker-compose >/dev/null 2>&1 || { echo >&2 "L'outil docker-compose n'est pas présent, cf https://docs.docker.com/compose/install/"; exit 1;}
|
||||
|
||||
###### Seules variables à modifier ######
|
||||
export GIREF_HOSTNAME=votre_machine
|
||||
export VOLUME=le_dossier_a_monter
|
||||
@ -10,10 +8,28 @@ export USER_ID=id_user_giref
|
||||
export GROUPE_ID=id_groupe
|
||||
##########################################
|
||||
|
||||
######### Ne pas éditer le reste #########
|
||||
command -v docker-compose >/dev/null 2>&1 || { echo >&2 "L'outil docker-compose n'est pas présent, cf https://docs.docker.com/compose/install/"; exit 1;}
|
||||
|
||||
editeCompose() {
|
||||
if [ ! -f docker-compose-template.yml ]; then
|
||||
echo "Erreur, fichier docker-compose-template.yml introuvable, l'avez-vous supprimer ?"
|
||||
else
|
||||
cp docker-compose-template.yml docker-compose.yml
|
||||
IFS=':' arrVOLUMES=($VOLUMES); unset IFS
|
||||
for i in "${arrVOLUMES[@]}"
|
||||
do
|
||||
v=" - \"$i:/home/project/$(basename $i):cached\""
|
||||
sed -i "/VOLUMES_WRAPPER/a\ $v" docker-compose.yml
|
||||
done
|
||||
sed -i "/VOLUMES_WRAPPER/d" docker-compose.yml
|
||||
fi
|
||||
}
|
||||
|
||||
# Ne pas éditer le reste
|
||||
export VPN_SERVER=vpn.ulaval.ca
|
||||
if [ "$1" == "up" ]; then
|
||||
rm -rf docker-compose.yml
|
||||
editeCompose
|
||||
echo "Veuillez rentrer votre mot de passe pour ${VPN_SERVER} :"
|
||||
read -s password
|
||||
export VPN_PASSWORD=$password
|
||||
@ -21,8 +37,13 @@ if [ "$1" == "up" ]; then
|
||||
echo -e "Vous pouvez vous connecter à \e[94mhttp://${GIREF_HOSTNAME}/theia/\e[39m (Attention, le / à la fin est important)"
|
||||
elif [ "$1" == "down" ]; then
|
||||
echo "Arrêt de theia..."
|
||||
export VPN_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1)
|
||||
docker-compose down
|
||||
elif [ "$1" == "build" ]; then
|
||||
export VPN_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1)
|
||||
docker-compose build theia
|
||||
else
|
||||
echo "Le script doit prendre un des arguments suivants: up, down, build, config"
|
||||
fi
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user