add docker files
This commit is contained in:
parent
89ab312cd1
commit
333cb589e0
14
Dockerfile
14
Dockerfile
@ -1,8 +1,18 @@
|
||||
# Utiliser une image de base légère
|
||||
FROM nginx:alpine
|
||||
|
||||
# Installer Git
|
||||
RUN apk add --no-cache git
|
||||
|
||||
# Cloner le dépôt GitLab dans le dossier /usr/share/nginx/html
|
||||
RUN git clone http://lab.canguidev.fr/cangui/canguidev.git /usr/share/nginx/html
|
||||
|
||||
# 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;'"]
|
||||
|
||||
@ -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
|
||||
|
||||
networks:
|
||||
npm-network:
|
||||
external: true
|
||||
|
||||
|
||||
9
update.sh
Normal file
9
update.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd /usr/share/nginx/html
|
||||
if [ -d ".git" ]; then
|
||||
echo "Updating repository..."
|
||||
git pull origin main # Met à jour les fichiers à partir du dépôt GitLab
|
||||
else
|
||||
echo "Cloning repository..."
|
||||
git clone https://gitlab.com/ton-utilisateur/ton-depot.git /usr/share/nginx/html
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user