This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-atr-experiments.git


The following commit(s) were added to refs/heads/main by this push:
     new f4e7649  Make the bind address for containers configurable
f4e7649 is described below

commit f4e764922450b085eb7a29f987590d06eb88b207
Author: Sean B. Palmer <s...@miscoranda.com>
AuthorDate: Thu Feb 13 19:50:23 2025 +0200

    Make the bind address for containers configurable
---
 Dockerfile.alpine | 4 +++-
 Dockerfile.ubuntu | 4 +++-
 Makefile          | 7 +++++--
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Dockerfile.alpine b/Dockerfile.alpine
index 6565c9d..1dbe87b 100644
--- a/Dockerfile.alpine
+++ b/Dockerfile.alpine
@@ -1,5 +1,7 @@
 FROM python:3.13.2-alpine3.21
 
+ARG BIND=127.0.0.1:8080
+ENV BIND=${BIND}
 ARG SCRIPTS=scripts/poetry
 ENV SCRIPTS=${SCRIPTS}
 
@@ -22,4 +24,4 @@ RUN rm -rf .venv-*
 RUN make sync PYTHON="$(which python3)"
 RUN make certs
 EXPOSE 8080
-CMD ["make", "serve"]
+CMD ["sh", "-c", "make serve BIND=${BIND}"]
diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu
index 647b277..b398498 100644
--- a/Dockerfile.ubuntu
+++ b/Dockerfile.ubuntu
@@ -1,6 +1,8 @@
 # We can't use 24.10 because deadsnakes does not yet support it
 FROM ubuntu:24.04
 
+ARG BIND=127.0.0.1:8080
+ENV BIND=${BIND}
 ARG SCRIPTS=scripts/poetry
 ENV SCRIPTS=${SCRIPTS}
 
@@ -22,4 +24,4 @@ RUN rm -rf .venv-*
 RUN make sync PYTHON="$(find /usr/bin -name python3.13 | head -n 1)"
 RUN make certs
 EXPOSE 8080
-CMD ["make", "serve"]
+CMD ["sh", "-c", "make serve BIND=${BIND}"]
diff --git a/Makefile b/Makefile
index dc931de..251f45c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
 .PHONY: build certs check docs report serve sync
 
+BIND ?= 127.0.0.1:8080
 MANAGER ?= poetry
 PYTHON ?= $(which python3)
 SCRIPTS ?= scripts/$(MANAGER)
@@ -8,7 +9,9 @@ build:
        $(SCRIPTS)/build
 
 certs:
-       $(SCRIPTS)/run scripts/generate-certificates
+       if test ! -f state/cert.pem || test ! -f state/key.pem; \
+       then $(SCRIPTS)/run scripts/generate-certificates; \
+       fi
 
 check:
        $(SCRIPTS)/run pre-commit run --all-files
@@ -22,7 +25,7 @@ report:
        @echo SCRIPTS = $(SCRIPTS)
 
 serve:
-       $(SCRIPTS)/run hypercorn --bind 127.0.0.1:8080 --keyfile key.pem 
--certfile cert.pem atr:app
+       $(SCRIPTS)/run hypercorn --bind $(BIND) --keyfile key.pem --certfile 
cert.pem atr:app
 
 sync:
        $(SCRIPTS)/sync $(PYTHON)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tooling.apache.org
For additional commands, e-mail: dev-h...@tooling.apache.org

Reply via email to