# Utilisation d'Alpine Linux comme base légère
FROM httpd:alpine3.21

# Définition des labels
LABEL MAINTAINER="moncef" \
      VERSION="1.8" \
      TP="3"

# Configuration des variables d'environnement
ENV SCHOOL="IUT" \
    LEVEL="1.8"

# Exposition du port 80
EXPOSE 80

# Clonage du dépôt Git (temporairement)
RUN apk add --no-cache git && \
    git clone https://github.com/MaximePIERRONT/beforeStage.git /tmp/repo && \
    cp /tmp/repo/static-site.html /usr/local/apache2/htdocs/index.html && \
    # Personnalisation du fichier HTML
    sed -i 's/NOM PRENOM/moncef/g' /usr/local/apache2/htdocs/index.html && \
    # Nettoyage
    rm -rf /tmp/repo && \
    apk del git

# Configuration du healthcheck
HEALTHCHECK --interval=1m --timeout=1s \
  CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1

# Commande de démarrage d'Apache
# Note: Cette commande est déjà définie dans l'image de base et n'est pas nécessaire,
# mais je la laisse pour la clarté
CMD ["httpd-foreground"]