Update Dockerfile

This commit is contained in:
gitea committed 2026-11-07 16:15:46 +01:00
1 parent dd943ea64b
commit 11bb7f1236
1 file changed
+74 -75
+74 -75
View File
@@ -1,75 +1,74 @@
# Only the instructions RUN, COPY, ADD create layers # Only the instructions RUN, COPY, ADD create layers
# Reference image # Reference image
FROM ubuntu:latest FROM ubuntu:latest
# Meta data (OCI standard) # Meta data (OCI standard)
LABEL org.opencontainers.image.title="My image" LABEL org.opencontainers.image.title="My image"
LABEL org.opencontainers.image.description="My description" LABEL org.opencontainers.image.description="My description"
LABEL org.opencontainers.image.authors="Pierre ROYER <mail@pierreau.fr>" LABEL org.opencontainers.image.authors="Pierre ROYER <mail@pierreau.fr>"
LABEL org.opencontainers.image.url="https://pierreau.fr/pro/" LABEL org.opencontainers.image.url="https://pierreau.fr/pro/"
LABEL org.opencontainers.image.version="2" LABEL org.opencontainers.image.version="2"
LABEL org.opencontainers.image.revision="1" LABEL org.opencontainers.image.revision="1"
LABEL org.opencontainers.image.created="2016-11-28T15:00:00+02:00" # UTC+2 (rfc3339) LABEL org.opencontainers.image.created="2016-11-28T15:00:00+02:00" # UTC+2 (rfc3339)
# Meta data (not standard) # Meta data (not standard)
LABEL Environment="production" Site="Nantes" LABEL Environment="production" Site="Nantes"
# Installing packages without interruption (Debian) # Installing packages without interruption (Debian)
# ARG DEBIAN_FRONTEND=noninteractive # ARG DEBIAN_FRONTEND=noninteractive
# Commands executed during image creation # Commands executed during image creation
# Change mirror source for best performances # Change mirror source for best performances
RUN sed -i 's/ports.ubuntu.com/fr.ports.ubuntu.com/' /etc/apt/sources.list.d/ubuntu.sources 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 RUN apt-get update && apt-get upgrade -y
RUN apt install -y --no-install-recommends \ RUN apt install -y --no-install-recommends \
apache2 \ apache2 \
cron \ cron \
curl \ curl \
openssh-server \ openssh-server \
tzdata \ tzdata \
vim \ vim \
wget wget
# Remove unnecessary files to optimize image size # Remove unnecessary files to optimize image size
RUN apt clean ; rm -rf /var/lib/apt/lists/* RUN apt clean ; rm -rf /var/lib/apt/lists/*
# Setup time zone # Setup time zone
ENV TZ=Europe/Paris ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN dpkg-reconfigure --frontend noninteractive tzdata RUN dpkg-reconfigure --frontend noninteractive tzdata
# Apache configuration # Apache configuration
RUN echo 'ServerName apache.pierreau.fr:80' >> /etc/apache2/apache2.conf RUN echo 'ServerName apache.pierreau.fr:80' >> /etc/apache2/apache2.conf
# Copying files from host to container # Copying files from host to container
# RUN cd /var/www/html/ # RUN cd /var/www/html/
# RUN mv index.html index.html.old # RUN mv index.html index.html.old
# COPY index.html /var/www/html/ # COPY --chown=www-data:www-data index.html /var/www/html/
# RUN wget https://cloud.pierreau.fr/index.html # RUN wget https://cloud.pierreau.fr/index.html
# Allows adding URLs or archives # Allows adding URLs or archives
ADD https://cloud.pierreau.fr/index.html . ADD https://cloud.pierreau.fr/index.html .
# Mount points created in container # Mount points created in container
VOLUME ["/var/www/html", "/etc/apache2", "/var/log/apache2/"] VOLUME ["/var/www/html", "/etc/apache2", "/var/log/apache2/"]
# Adding a user # Adding a user
RUN useradd -m -s /bin/bash -p M0t2P@$$ sshuser RUN useradd -m -s /bin/bash -p M0t2P@$$ sshuser
USER sshuser USER sshuser
# Specifies default directory # Specifies default directory
WORKDIR /home/sshuser WORKDIR /home/sshuser
RUN echo "df -h" > .profile RUN echo "df -h" > .profile
USER root USER root
# ENTRYPOINT command (not overridable by docker run) launched at container startup # ENTRYPOINT command (not overridable by docker run) launched at container startup
# COPY docker-entrypoint.sh /root/ # COPY --chmod=700 docker-entrypoint.sh /root/
# RUN chmod 700 /root/docker-entrypoint.sh # ENTRYPOINT ["/root/docker-entrypoint.sh"]
# ENTRYPOINT ["/root/docker-entrypoint.sh"]
# Command (overloadable by docker run) launched when the container starts
# Command (overloadable by docker run) launched when the container starts CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
# For information purposes, specifies the ports/protocols used
# For information purposes, specifies the ports/protocols used EXPOSE 80 22/tcp 123/udp
EXPOSE 80 22/tcp 123/udp