From 13fdf1138cd233e3b565cb438971a424845846d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 19 Mar 2024 15:02:31 +0100 Subject: [PATCH] docker: support changin httpd port with env var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- Dockerfile | 6 ++++-- docker-compose.yml | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 36fcbce..089198d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,5 +12,7 @@ RUN yarn build FROM lipanski/docker-static-website:latest COPY --from=builder /app/dist . COPY httpd.conf . -EXPOSE 3000 -CMD ["/busybox", "httpd", "-f", "-v", "-p", "3000", "-c", "httpd.conf"] +ARG PORT=3000 +EXPOSE ${PORT} +ENTRYPOINT ["/busybox", "httpd"] +CMD ["-f", "-v", "-p", "${PORT}", "-c", "httpd.conf"] diff --git a/docker-compose.yml b/docker-compose.yml index e8e6ee8..6d9718e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,14 @@ services: container_name: terminal restart: unless-stopped ports: - - 3000:3000 + - '0.0.0.0:${PORT:-3000}:${PORT:-3000}' + command: > + -f + -v + -p ${PORT:-3000} + -c httpd.conf healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:80"] + test: ["CMD", "curl", "-f", "http://localhost:${PORT:-3000}"] interval: 200s timeout: 200s retries: 5