feat: nebulosus tmp solution
Signed-off-by: Raine <raine@ixvd.net>
This commit is contained in:
parent
759852140a
commit
83a548ca8f
20 changed files with 153 additions and 127 deletions
16
images/nginx/Dockerfile
Normal file
16
images/nginx/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
|||
FROM nginx:alpine
|
||||
|
||||
RUN apk add \
|
||||
certbot \
|
||||
certbot-nginx
|
||||
|
||||
COPY content /usr/share/nginx/html
|
||||
COPY conf.d/ /etc/nginx/conf.d/
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
VOLUME /etc/nginx/conf.d/
|
||||
VOLUME /usr/share/nginx/html/
|
||||
|
||||
COPY entrypoint.sh /entrypoint
|
||||
ENTRYPOINT [ "sh", "/entrypoint" ]
|
||||
CMD [ "nginx", "-g", "daemon off;" ]
|
17
images/nginx/conf.d/default.conf
Normal file
17
images/nginx/conf.d/default.conf
Normal file
|
@ -0,0 +1,17 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
# SSL is managed by certbot, no need for a ssl listen; it will be generated automagically!
|
||||
|
||||
# default html page
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
24
images/nginx/content/index.html
Normal file
24
images/nginx/content/index.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Welcome to nginx!</title>
|
||||
<style>
|
||||
html {
|
||||
color-scheme: light dark;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 35em;
|
||||
margin: 0 auto;
|
||||
font-family: Tahoma, Verdana, Arial, sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Welcome to nginx!</h1>
|
||||
<span>This is the default page, so the admin was likely too lazy too remove it.</span>
|
||||
</body>
|
||||
|
||||
</html>
|
28
images/nginx/entrypoint.sh
Executable file
28
images/nginx/entrypoint.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
trap exit TERM
|
||||
|
||||
if [ -n "${CERTBOT_DOMAINS}" ]; then
|
||||
echo "registering..."
|
||||
if ! certbot show_account; then
|
||||
certbot register -n \
|
||||
--agree-tos \
|
||||
-m "${CERTBOT_EMAIL}"
|
||||
fi
|
||||
|
||||
for d in $(echo "${CERTBOT_DOMAINS}" | sed 's/,/ /g'); do
|
||||
echo "requesting for $d..."
|
||||
certbot --nginx -n --keep -d "$d"
|
||||
done
|
||||
|
||||
while :; do
|
||||
echo "renewing domains..."
|
||||
certbot --nginx --keep -n renew
|
||||
sleep 12h &
|
||||
wait $!
|
||||
done &
|
||||
else
|
||||
echo "skipping certbot due to no domains!"
|
||||
fi &
|
||||
|
||||
exec "$@"
|
Loading…
Add table
Add a link
Reference in a new issue