some work done need to go to class now

This commit is contained in:
Pagwin 2023-09-12 14:55:06 -04:00
parent 92186c3a58
commit 5deea869e4
No known key found for this signature in database
GPG key ID: F5FB283DD4B1A998
3 changed files with 40 additions and 2 deletions

View file

@ -4,9 +4,20 @@ RUN ["apk", "update"]
RUN ["apk", "add hugo"] RUN ["apk", "add hugo"]
ADD . /root/ ADD . /root/
WORKDIR /root WORKDIR /root
ARG WITH_COMMENTS=0 # pass in the uri or ip of the comments api so nginx can forward to it
ARG COMMENTS_BACKEND
ENV COMMENTS_BACKEND=${WITH_BACKEND}
RUN ["hugo", "--minify"] RUN ["hugo", "--minify"]
FROM nginx:1.25 FROM python:3.11-alpine as fiddling
RUN ["adduser", "-h", "/application", "application"]
# might need to chown these
ADD ./scripts/template_convert.py /application/template_convert.py
ADD ./nginx.conf.template /application/nginx.conf.template
WORKDIR /application
USER application
RUN ["python", "/application/template_convert.py"]
FROM nginx:1.25
COPY --from=fiddling /application/nginx.conf
RUN RUN

27
nginx.conf.template Normal file
View file

@ -0,0 +1,27 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name pagwin.xyz;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
# weird comments around this block is so we can easily yeet it if the comments backend isn't present
###{---
location /comments {
# we're going to use a python program to substitute this out
proxy_pass http://${{COMMENTS_BACKEND}}
}
}

View file