there is a map with a marker, and the docker don't generate a new certificate all the time

This commit is contained in:
lenovo
2022-10-29 17:11:25 +02:00
parent 40963ce3cb
commit 4dca5a4760
15 changed files with 129 additions and 106 deletions

View File

@@ -16,10 +16,15 @@ COPY ./conf/inception_nginx.conf /etc/nginx/http.d/
RUN adduser -S www-data && \
adduser www-data www-data
RUN mkdir -p /var/www/html
ARG WP_URL
ARG MAX_UPLOAD_SIZE
ARG WP_VOLUME_DIR
ARG WP_VOLUME_PLUGINS
ARG NG_VOLUME_CERTS
# create and empty volumes dir
RUN mkdir -p ${WP_VOLUME_DIR} ${WP_VOLUME_PLUGINS} ${NG_VOLUME_CERTS} && \
rm -rf ${WP_VOLUME_DIR}/* ${WP_VOLUME_PLUGINS}/* ${NG_VOLUME_CERTS}/*
# replace WP_URL
RUN sed -i "s/\${WP_URL}/${WP_URL}/g" /etc/nginx/http.d/inception_nginx.conf
@@ -27,18 +32,15 @@ RUN sed -i "s/\${WP_URL}/${WP_URL}/g" /etc/nginx/http.d/inception_nginx.conf
# replace max file size upload
RUN sed -i "s/\(client_max_body_size \).*\(m;\)/\1${MAX_UPLOAD_SIZE}\2/g" /etc/nginx/nginx.conf
# empty /var/www/html folder to avoid it to rewrite volume
#RUN rm -rf /var/www/html/*
# personalized index.html
COPY ./conf/index.html /data/www/
# create ssl certificate
RUN mkdir -p /etc/ssl/private /etc/ssl/certs
RUN openssl req -newkey rsa:2048 -nodes -x509 -days 365 \
-subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=inception/CN=${WP_URL}" \
-keyout /etc/ssl/private/${WP_URL}.key \
-out /etc/ssl/certs/${WP_URL}.crt
COPY ./conf/ssl ${NG_VOLUME_CERTS}
RUN if [ -z "$(ls -A ${NG_VOLUME_CERTS} 2>/dev/null)" ]; then \
mkdir ${NG_VOLUME_CERTS}/private ${NG_VOLUME_CERTS}/certs; \
openssl req -newkey rsa:2048 -nodes -x509 -days 365 \
-subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=inception/CN=${WP_URL}" \
-keyout ${NG_VOLUME_CERTS}/private/${WP_URL}.key \
-out ${NG_VOLUME_CERTS}/certs/${WP_URL}.crt; \
fi
ENTRYPOINT [ "nginx", "-g", "daemon off;" ]