Skip to content

Commit

Permalink
Docker: allow configuration of HTTP listen port via env var (#28840)
Browse files Browse the repository at this point in the history
* Docker: allow configuration of HTTP listen port via env var

* Update docs/install.md

Co-authored-by: Michael Telatynski <[email protected]>

* prettier

---------

Co-authored-by: Michael Telatynski <[email protected]>
  • Loading branch information
richvdh and t3chguy authored Jan 3, 2025
1 parent bd3e93e commit 703149d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
10 changes: 10 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 703149d

Please sign in to comment.