Optimize Dockerfile for Apache2 by consolidating installation commands and cleaning up APT lists

This commit is contained in:
Lukian 2025-01-21 09:02:07 +01:00
parent a8d6645eee
commit fda4c4376e

View file

@ -1,9 +1,7 @@
FROM ubuntu:lastest AS webserver FROM ubuntu:lastest AS webserver
RUN apt-get update && apt-get install -y apache2
RUN apt-get update && apt-get install -y apache2 openssl ca-certificates \ RUN apt-get update && apt-get install -y apache2 openssl ca-certificates \
&& openssl req -nodes -newkey rsa:2048 -sha256 -keyout private-rsa.key -out certifactes.csr && openssl req -nodes -newkey rsa:2048 -sha256 -keyout private-rsa.key -out certifactes.csr \
rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/html WORKDIR /var/www/html
COPY ./public/ . COPY ./public/ .
CMD ["apache2ctl", "-D", "FOREGROUND"] CMD ["apache2ctl", "-D", "FOREGROUND"]