FROM nginx:bookworm

# snakeoil for localhost

RUN apt-get update && \
    apt-get install -y openssl && \
    openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 && \
    openssl rsa -passin pass:x -in server.pass.key -out server.key && \
    rm server.pass.key && \
    openssl req -new -key server.key -out server.csr \
        -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost" && \
    openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt &&\
    mv server.crt /etc/nginx/nginx.crt && \
    mv server.key /etc/nginx/nginx.key \
