Docker: allow configuration of HTTP listen port via env var (#28840)

* Docker: allow configuration of HTTP listen port via env var

* Update docs/install.md

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

* prettier

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
travis/investigate-oom
Richard van der Hoff 2025-01-03 11:46:12 +00:00 committed by GitHub
parent bd3e93e8dd
commit 703149d76d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 4 deletions

View File

@ -21,8 +21,12 @@ FROM nginx:alpine-slim
COPY --from=builder /src/webapp /app
# Override default nginx config
COPY /nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
# Override default nginx config. Templates in `/etc/nginx/templates` are passed
# through `envsubst` by the nginx docker image entry point.
COPY /docker/nginx-templates/* /etc/nginx/templates/
RUN rm -rf /usr/share/nginx/html \
&& ln -s /app /usr/share/nginx/html
# HTTP listen port
ENV ELEMENT_WEB_PORT=80

View File

@ -1,6 +1,6 @@
server {
listen 80;
listen [::]:80;
listen ${ELEMENT_WEB_PORT};
listen [::]:${ELEMENT_WEB_PORT};
server_name localhost;
root /usr/share/nginx/html;

View File

@ -60,6 +60,16 @@ would be:
docker run --rm -p 127.0.0.1:80:80 -v /etc/element-web/config.json:/app/config.json vectorim/element-web
```
The behaviour of the docker image can be customised via the following
environment variables:
- `ELEMENT_WEB_PORT`
The port to listen on (within the docker container) for HTTP
traffic. Defaults to `80`.
### Building the docker image
To build the image yourself:
```bash