FROM alpine:3.15 # vim and bash for debug RUN apk update && apk add \ nginx openssl \ vim bash \ && \ rm -rf /var/cache/apk* # nginx conf COPY ./conf/nginx.conf.alpine /etc/nginx/nginx.conf COPY ./conf/inception_nginx.conf /etc/nginx/http.d/ # create user www-data and assign it to group www-data RUN adduser -S www-data && \ adduser www-data www-data RUN mkdir -p /var/www/html ARG WP_URL ARG MAX_UPLOAD_SIZE # replace WP_URL 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 ENTRYPOINT [ "nginx", "-g", "daemon off;" ]