Skip to content

Commit 962136d

Browse files
authored
Avoid using /tmp/ for bind mounts and non-tmpfs binds (#29488)
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 917d53a commit 962136d

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

.github/workflows/docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
--rm \
7878
-e "ELEMENT_WEB_PORT=$ELEMENT_WEB_PORT" \
7979
-dp "$ELEMENT_WEB_PORT:$ELEMENT_WEB_PORT" \
80-
-v $(pwd)/modules:/tmp/element-web-modules \
80+
-v $(pwd)/modules:/modules \
8181
"$IMAGEID" \
8282
)
8383

docker/docker-entrypoint.d/18-load-element-modules.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
# Loads modules from `/tmp/element-web-modules` into config.json's `modules` field
3+
# Loads modules from `/modules` into config.json's `modules` field
44

55
set -e
66

@@ -15,15 +15,15 @@ mkdir -p /tmp/element-web-config
1515
cp /app/config*.json /tmp/element-web-config/
1616

1717
# If there are modules to be loaded
18-
if [ -d "/tmp/element-web-modules" ]; then
19-
cd /tmp/element-web-modules
18+
if [ -d "/modules" ]; then
19+
cd /modules
2020

2121
for MODULE in *
2222
do
2323
# If the module has a package.json, use its main field as the entrypoint
2424
ENTRYPOINT="index.js"
25-
if [ -f "/tmp/element-web-modules/$MODULE/package.json" ]; then
26-
ENTRYPOINT=$(jq -r '.main' "/tmp/element-web-modules/$MODULE/package.json")
25+
if [ -f "/modules/$MODULE/package.json" ]; then
26+
ENTRYPOINT=$(jq -r '.main' "/modules/$MODULE/package.json")
2727
fi
2828

2929
entrypoint_log "Loading module $MODULE with entrypoint $ENTRYPOINT"

docker/nginx-templates/default.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ server {
2222
add_header Cache-Control "no-cache";
2323
}
2424
location /modules {
25-
alias /tmp/element-web-modules;
25+
alias /modules;
2626
}
2727
# redirect server error pages to the static page /50x.html
2828
#

docs/install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ image as root (`docker run --user 0`) or, better, change the port that nginx
6767
listens on via the `ELEMENT_WEB_PORT` environment variable.
6868

6969
[Element Web Modules](https://github.com/element-hq/element-modules/tree/main/packages/element-web-module-api) can be dynamically loaded
70-
by being made available (e.g. via bind mount) in a directory within `/tmp/element-web-modules/`.
70+
by being made available (e.g. via bind mount) in a directory within `/modules/`.
7171
The default entrypoint will be index.js in that directory but can be overridden if a package.json file is found with a `main` directive.
7272
These modules will be presented in a `/modules` subdirectory within the webroot, and automatically added to the config.json `modules` field.
7373

7474
If you wish to use docker in read-only mode,
7575
you should follow the [upstream instructions](https://hub.docker.com/_/nginx#:~:text=Running%20nginx%20in%20read%2Donly%20mode)
7676
but additionally include the following directories:
7777

78-
- /tmp/element-web-config/
78+
- /tmp/
7979
- /etc/nginx/conf.d/
8080

8181
The behaviour of the docker image can be customised via the following

0 commit comments

Comments
 (0)