Upload files to "/"
This commit is contained in:
91
Dockerfile
91
Dockerfile
@@ -1,75 +1,32 @@
|
|||||||
# Only the instructions RUN, COPY, ADD create layers
|
# Image de référence
|
||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
# Reference image
|
# Données méta
|
||||||
FROM ubuntu:latest
|
LABEL org.opencontainers.image.title="Serveur Apache"
|
||||||
|
LABEL org.opencontainers.image.version="1"
|
||||||
|
LABEL org.opencontainers.image.revision="0"
|
||||||
|
LABEL environment="formation"
|
||||||
|
|
||||||
# Meta data (OCI standard)
|
# Commandes exécuteés pendant la création de l’image
|
||||||
LABEL org.opencontainers.image.title="My image"
|
RUN apt-get update && apt-get upgrade -y
|
||||||
LABEL org.opencontainers.image.description="My description"
|
RUN apt install -y apache2
|
||||||
LABEL org.opencontainers.image.authors="Pierre ROYER <mail@pierreau.fr>"
|
RUN apt-get clean ; rm -rf /var/lib/apt/lists/*
|
||||||
LABEL org.opencontainers.image.url="https://pierreau.fr/pro/"
|
|
||||||
LABEL org.opencontainers.image.version="2"
|
|
||||||
LABEL org.opencontainers.image.revision="1"
|
|
||||||
LABEL org.opencontainers.image.created="2016-11-28T15:00:00+02:00" # UTC+2 (rfc3339)
|
|
||||||
# Meta data (not standard)
|
|
||||||
LABEL Environment="production" Site="Nantes"
|
|
||||||
|
|
||||||
# Installing packages without interruption (Debian)
|
# Configuration Apache
|
||||||
# ARG DEBIAN_FRONTEND=noninteractive
|
RUN echo 'ServerName apache.formation.fr:80' >> /etc/apache2/apache2.conf
|
||||||
|
|
||||||
# Commands executed during image creation
|
# Spécifier de répertoire courant
|
||||||
# Change mirror source for best performances
|
WORKDIR /var/www/html/
|
||||||
RUN sed -i 's/ports.ubuntu.com/fr.ports.ubuntu.com/' /etc/apt/sources.list.d/ubuntu.sources
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y
|
# Copie du fichier host vers le conteneur
|
||||||
RUN apt install -y --no-install-recommends \
|
RUN mv index.html index.html.old
|
||||||
apache2 \
|
COPY index.html .
|
||||||
cron \
|
|
||||||
curl \
|
|
||||||
openssh-server \
|
|
||||||
tzdata \
|
|
||||||
vim \
|
|
||||||
wget
|
|
||||||
|
|
||||||
# Remove unnecessary files to optimize image size
|
# Commande lancée au démarrage du conteneur
|
||||||
RUN apt clean ; rm -rf /var/lib/apt/lists/*
|
# CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
|
||||||
|
|
||||||
# Setup time zone
|
# Vérifie l’état de santé (pour un serveur web)
|
||||||
ENV TZ=Europe/Paris
|
# HEALTHCHECK --start-period=30s --interval=1m --timeout=2s --retries=5 CMD curl -f http://localhost/ || exit 1
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
||||||
RUN dpkg-reconfigure --frontend noninteractive tzdata
|
|
||||||
|
|
||||||
# Apache configuration
|
# Port réseau utilisé
|
||||||
RUN echo 'ServerName apache.pierreau.fr:80' >> /etc/apache2/apache2.conf
|
EXPOSE 80/tcp
|
||||||
|
|
||||||
# Copying files from host to container
|
|
||||||
# RUN cd /var/www/html/
|
|
||||||
# RUN mv index.html index.html.old
|
|
||||||
# COPY index.html /var/www/html/
|
|
||||||
|
|
||||||
# RUN wget https://cloud.pierreau.fr/index.html
|
|
||||||
|
|
||||||
# Allows adding URLs or archives
|
|
||||||
ADD https://cloud.pierreau.fr/index.html .
|
|
||||||
|
|
||||||
# Mount points created in container
|
|
||||||
VOLUME ["/var/www/html", "/etc/apache2", "/var/log/apache2/"]
|
|
||||||
|
|
||||||
# Adding a user
|
|
||||||
RUN useradd -m -s /bin/bash -p M0t2P@$$ sshuser
|
|
||||||
USER sshuser
|
|
||||||
# Specifies default directory
|
|
||||||
WORKDIR /home/sshuser
|
|
||||||
RUN echo "df -h" > .profile
|
|
||||||
USER root
|
|
||||||
|
|
||||||
# ENTRYPOINT command (not overridable by docker run) launched at container startup
|
|
||||||
# COPY docker-entrypoint.sh /root/
|
|
||||||
# RUN chmod 700 /root/docker-entrypoint.sh
|
|
||||||
# ENTRYPOINT ["/root/docker-entrypoint.sh"]
|
|
||||||
|
|
||||||
# Command (overloadable by docker run) launched when the container starts
|
|
||||||
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
|
|
||||||
|
|
||||||
# For information purposes, specifies the ports/protocols used
|
|
||||||
EXPOSE 80 22/tcp 123/udp
|
|
||||||
|
|||||||
Reference in New Issue
Block a user