Allow dev users to select the port that is listened on.

This commit is contained in:
lingfish
2026-02-25 15:22:45 +11:00
parent aa25dc7b31
commit bf2a1c6b25
5 changed files with 12 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
PORT=3000
+2 -1
View File
@@ -12,6 +12,7 @@ RUN /app/docs/fetch-contributors >> /contributors.html
FROM docker.io/node:22.4.0-alpine AS html
ARG ENVIRONMENT=production
ARG PORT=3000
WORKDIR /source
@@ -28,7 +29,7 @@ COPY --from=borgmatic /etc/borgmatic/options.json /source/docs/reference/configu
COPY --from=borgmatic /command-line/* /source/docs/_includes/borgmatic/command-line/
COPY --from=borgmatic /contributors.html /source/docs/_includes/borgmatic/contributors.html
COPY . /source
RUN NODE_ENV=${ENVIRONMENT} npx eleventy --input=/source/docs --output=/output
RUN NODE_ENV=${ENVIRONMENT} PORT=${PORT} npx eleventy --input=/source/docs --output=/output
RUN npx -y pagefind --site /output
FROM docker.io/nginx:1.26.1-alpine
+2 -1
View File
@@ -1,5 +1,6 @@
module.exports = function() {
return {
environment: process.env.NODE_ENV || "development"
environment: process.env.NODE_ENV || "development",
port: process.env.PORT || 8080
};
};
+1 -1
View File
@@ -21,7 +21,7 @@ headerClass: elv-header-default
{% set navPages = collections.all | eleventyNavigation %}
{% macro renderNavListItem(entry) -%}
<li{% if entry.url == page.url %} class="elv-toc-active"{% endif %}>
<a {% if entry.url %}href="{% if borgmatic.environment == "production" %}https://torsion.org/borgmatic{% else %}http://localhost:8080/borgmatic{% endif %}{{ entry.url | url }}"{% endif %}>{{ entry.title }}</a>
<a {% if entry.url %}href="{% if borgmatic.environment == "production" %}https://torsion.org/borgmatic{% else %}http://localhost:{{ borgmatic.port }}/borgmatic{% endif %}{{ entry.url | url }}"{% endif %}>{{ entry.title }}</a>
{%- if entry.children.length -%}
<ul>
{%- for child in entry.children %}{{ renderNavListItem(child) }}{% endfor -%}
+6 -3
View File
@@ -2,10 +2,12 @@ services:
traefik:
image: public.ecr.aws/docker/library/traefik:3.5.3
container_name: borgmatic-docs-traefik
environment:
- PORT=${PORT}
command:
- "--global.checkNewVersion=false"
- "--global.sendAnonymousUsage=false"
- "--entrypoints.web.address=:8080"
- "--entrypoints.web.address=:${PORT}"
- "--accesslog"
- "--accesslog.fields.headers.defaultmode=keep"
- "--providers.docker"
@@ -14,7 +16,7 @@ services:
- "--api.dashboard=false"
- "--log.level=WARN"
ports:
- "127.0.0.1:8080:8080"
- "127.0.0.1:${PORT}:${PORT}"
volumes:
- ${CONTAINER_SOCKET_PATH:-/run/user/docker.sock}:/var/run/docker.sock:ro
docs:
@@ -37,6 +39,7 @@ services:
context: ..
args:
ENVIRONMENT: development
PORT: 3000
message:
image: alpine
container_name: borgmatic-docs-message
@@ -44,6 +47,6 @@ services:
- sh
- -c
- |
echo; echo "You can view dev docs at http://localhost:8080/borgmatic/"; echo
echo; echo "You can view dev docs at http://localhost:${PORT}/borgmatic/"; echo
depends_on:
- docs