# Image de référence FROM ubuntu:latest # Données méta LABEL org.opencontainers.image.title="Serveur Apache" LABEL org.opencontainers.image.version="1" LABEL org.opencontainers.image.revision="0" LABEL environment="formation" # Commandes exécuteés pendant la création de l’image RUN apt-get update && apt-get upgrade -y RUN apt install -y apache2 RUN apt-get clean ; rm -rf /var/lib/apt/lists/* # Configuration Apache RUN echo 'ServerName apache.formation.fr:80' >> /etc/apache2/apache2.conf # Spécifier de répertoire courant WORKDIR /var/www/html/ # Copie du fichier host vers le conteneur RUN mv index.html index.html.old COPY index.html . # Commande lancée au démarrage du conteneur # CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"] # Vérifie l’état de santé (pour un serveur web) # HEALTHCHECK --start-period=30s --interval=1m --timeout=2s --retries=5 CMD curl -f http://localhost/ || exit 1 # Port réseau utilisé EXPOSE 80/tcp