Compare commits

...

10 Commits

5 changed files with 34 additions and 7 deletions

View File

@ -1,8 +1,15 @@
# Utiliser une image de base légère
FROM nginx:alpine
# Installer Git
RUN apk add --no-cache git
# Copier le script d'update
COPY update.sh /usr/local/bin/update.sh
RUN chmod +x /usr/local/bin/update.sh
# Exposer le port 80
EXPOSE 80
# Démarrer Nginx
CMD ["nginx", "-g", "daemon off;"]
# Mettre à jour le dépôt à chaque démarrage et lancer Nginx
CMD ["/bin/sh", "-c", "/usr/local/bin/update.sh && nginx -g 'daemon off;'"]

View File

@ -4,11 +4,10 @@ services:
ports:
- "8084:80"
volumes:
- ./src:/usr/share/nginx/html # Synchroniser les modifications du dossier src
- ./src:/usr/share/nginx/html # Synchronisation locale (si nécessaire)
networks:
- npm-network
- dokploy-network
networks:
npm-network:
dokploy-network:
external: true

View File

@ -9,7 +9,7 @@
<div class="vh">
<div>
<div class="wrap">
<h1>Maintenance mode ;) test c</h1>
<h1>Maintenance mode !!</h1>
<h2><p>Sorry for the inconvenience.<br>Our website is currently undergoing scheduled maintenance.<br><br></p></h2>
<p>Thank you for your understanding.</p>
</div>

21
update.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/sh
cd /usr/share/nginx/html
if [ -d ".git" ]; then
echo "Updating repository..."
git pull origin main
else
echo "Cloning repository..."
git clone http://lab.canguidev.fr/cangui/canguidev.git /usr/share/nginx/html
fi
# Si le dossier src existe après le clone/pull, déplace-le dans /usr/share/nginx/html
if [ -d "/usr/share/nginx/html/src" ]; then
echo "Moving src to root of Nginx directory..."
mv /usr/share/nginx/html/src/* /usr/share/nginx/html/
rm -rf /usr/share/nginx/html/src
fi
# Supprimer les fichiers inutiles dans le répertoire de service Nginx
rm -f /usr/share/nginx/html/Dockerfile
rm -f /usr/share/nginx/html/docker-compose.yml
rm -f /usr/share/nginx/html/update.sh