Skip to content

Commit

Permalink
keep certificates if already created in older run
Browse files Browse the repository at this point in the history
  • Loading branch information
fabalexsie committed May 30, 2024
1 parent 094725a commit 2d6133f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM richarvey/nginx-php-fpm:latest
ENV PHP_UPLOAD_MAX_FILESIZE 10000
ENV PHP_POST_MAX_SIZE 10000
ENV PHP_MEM_LIMIT 10000
ENV RUN_SCRIPTS 1

ARG HOSTIP
ENV HOSTIP=${HOSTIP}
Expand All @@ -12,6 +11,7 @@ RUN curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
RUN chmod +x mkcert-v*-linux-amd64
RUN cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert

VOLUME /etc/nginx/ssl
WORKDIR /var/www/html
RUN mkdir -p /var/www/html/uploads
COPY nginx.conf /etc/nginx/
Expand Down
11 changes: 9 additions & 2 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
cd /etc/nginx/ssl
mkcert -install
mkcert localhost ${HOSTIP}
# if localhost+1.pem do not already exist, create them
if [ -f "/etc/nginx/ssl/localhost+1.pem" ]; then
echo "SSL certificate already exists"
else
mkcert -install
cp /root/.local/share/mkcert/rootCA.pem /var/www/html/uploads/rootCA.pem
echo "You find the rootCA.pem in the uploads folder"
mkcert localhost ${HOSTIP}
fi

# Start the server
/start.sh

0 comments on commit 2d6133f

Please sign in to comment.