Outils pour utilisateurs

Outils du site


docker:rest-server

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
docker:rest-server [2020/05/28 19:28] – créée rootdocker:rest-server [2021/06/20 09:40] (Version actuelle) – modification externe 127.0.0.1
Ligne 6: Ligne 6:
 FROM node:10-alpine FROM node:10-alpine
 ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-ADD test.sh /usr/bin/ +COPY rest-server /usr/bin/ 
-WORKDIR /usr/bin +COPY start.sh 
-#COPY package*.json ./ +EXPOSE 8000 
-#RUN npm install +CMD ["/start.sh"] 
-#RUN apt update && apt-get install golang-go git make -y +</code> 
-#RUN chmod +x /usr/bin/test.sh + 
-#RUN git clone https://github.com/restic/rest-server && cd rest-server && make && make install && apt remove golang-go git -y && apt autoremove -y && cd .. && rm rest-server/ -R +  - Créer un fichier start.sh: <code bash>nano start.sh</code> et introduisez les lignes suivantes <code>#!/bin/sh 
-#CMD ["ls",,"-l","/usr/bin"] + 
-CMD ["/usr/local/bin/rest-server"] +set -e 
-#CMD ["test.sh"] +echo makeITsimple Rest Server 
-#COPY . .+echo ------------------------ 
 +echo Args: $OPTION 
 +echo 
 + 
 +if ! -f "$CHEMIN/.htpasswd]; then 
 +    echo "htpasswd doesn't exist creating it" 
 +    touch $CHEMIN/.htpasswd 
 +fi 
 + 
 +if [ ! -z "$OPTION" ] && ! -z "$CHEMIN" ]; then 
 +        exec /usr/bin/rest-server --path $CHEMIN $OPTION 
 +        else 
 +        echo "Pas de variables OPTIONS ou CHEMIN défini
 +        fi
  
 </code> </code>
 +  - Exporter l'image <code bash>docker save makeitsimple-rest-server > test.tar</code>
  
  
Ligne 24: Ligne 38:
 <code bash>echo Suppression anciennes images <code bash>echo Suppression anciennes images
 echo **************************** echo ****************************
 +echo
 docker image rmi test -f docker image rmi test -f
-echo. 
 echo Création nouvelle image echo Création nouvelle image
 echo *********************** echo ***********************
 docker build . -t test docker build . -t test
-echo.+echo
 echo Lancement nouvelle image echo Lancement nouvelle image
 echo ************************ echo ************************
-echo. +echo 
-docker run -ti test -v /tmp:/data/test+docker run -ti -v /root/test/data:/tmp -e OPTION="--append-only --private-repos" -e CHEMIN="/tmp" test 
 </code> </code>
 +Création d'un user htpasswd -nbB user password
 +
 +===== Sources =====
 +  * https://stackify.com/docker-build-a-beginners-guide-to-building-docker-images/
 +  * https://xataz.developpez.com/tutoriels/utilisation-docker/#LVI-A
 +
docker/rest-server.1590694105.txt.gz · Dernière modification : (modification externe)