Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more than one IP address #35

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
##
# Base
##
FROM nginx:1.27.0-alpine3.19-slim@sha256:a529900d9252ce5d04531a4a594f93736dbbe3ec155a692d10484be82aaa159a AS base
FROM nginx:1.27.3-alpine-slim@sha256:5a56ae385906c5b43ccc99379bce883aa93dc0556d7f705ba501d819925e8fa1 AS base

COPY /base /

RUN apk add --no-cache \
ca-certificates=~20240226 \
ca-certificates=~20241121 \
gnutls-utils=~3

ARG workdir=/var/www
Expand Down
7 changes: 4 additions & 3 deletions context/base/docker-entrypoint.d/20-certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ CERT_KEY="/cert/${FIRST_VIRTUAL_HOST:-localhost}.key"
CA_CERT="/rootCA/rootCA.pem"
CA_KEY="/rootCA/rootCA-key.pem"

IP_ADDRESS=$(hostname -i)
export IP_ADDRESS

envsubst </etc/https-proxy/cert.cfg.template >/tmp/cert.cfg

for host in ${VIRTUAL_HOST:-localhost}; do
echo "dns_name = $host" >>/tmp/cert.cfg
done

for ip_address in $(hostname -i); do
echo "ip_address = $ip_address" >>/tmp/cert.cfg
done

certtool --generate-privkey --outfile "${CERT_KEY}"

if [ ! -r "${CA_CERT}" ] || [ ! -r "${CA_KEY}" ]; then
Expand Down
1 change: 0 additions & 1 deletion context/base/etc/https-proxy/cert.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ organization = "Development certificate"
unit = "${HOSTNAME}"
cn = "${FIRST_VIRTUAL_HOST}"
expiration_days = ${EXPIRATION_DAYS}
ip_address = "${IP_ADDRESS}"