-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add cron job and SSL configuration in nginx Dockerfile
- Loading branch information
1 parent
3816e80
commit f3a54a5
Showing
5 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,21 @@ | ||
FROM nginx:1.25.4 | ||
|
||
# COPY ./start.sh /docker-entrypoint.d/ | ||
# RUN chmod +x /docker-entrypoint.d/start.sh | ||
# Add cron job to reload nginx every 24 hours | ||
RUN echo "0 0 * * * root docker exec -it nginx nginx -s reload" > /etc/cron.d/nginx-job | ||
|
||
# Download extra SSL configuration files | ||
RUN curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot-nginx/certbot_nginx/_internal/tls_configs/options-ssl-nginx.conf > /options-ssl-nginx.conf && \ | ||
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot/certbot/ssl-dhparams.pem > /ssl-dhparams.pem | ||
|
||
# Set the default environment variable | ||
ARG IS_SSL_ACQUIRED | ||
|
||
# Copy template file based on SSL certificate acquisition | ||
RUN if [ "$IS_SSL_ACQUIRED" = "true" ]; then \ | ||
cp ./default.conf.template /etc/nginx/templates/default.conf.template; \ | ||
else \ | ||
cp ./default.staging.conf.template /etc/nginx/templates/default.conf.template; \ | ||
fi | ||
|
||
# COPY proxy params | ||
COPY ./proxy_params /etc/nginx/proxy_params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
server { | ||
listen 80; | ||
server_name ${SERVER_NAME}; | ||
|
||
location /.well-known/acme-challenge/ { | ||
root /var/www/certbot; | ||
} | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} |