mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 11:05:03 +01:00
Merge pull request #997 from vector-im/hughns/docker-unprivileged
This commit is contained in:
commit
bd6ab1d5de
@ -10,10 +10,17 @@ RUN yarn install
|
|||||||
COPY . /app
|
COPY . /app
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
FROM --platform=${BUILDPLATFORM} docker.io/nginx:alpine
|
# Because we will be running as an unprivileged user, we need to make sure that the config file is writable
|
||||||
|
# So, we will copy the default config to the /tmp folder that will be writable at runtime
|
||||||
|
RUN mv -f target/config.json /config.json.bundled \
|
||||||
|
&& ln -sf /tmp/config.json target/config.json
|
||||||
|
|
||||||
|
FROM --platform=${BUILDPLATFORM} docker.io/nginxinc/nginx-unprivileged:alpine
|
||||||
|
|
||||||
# Copy the dynamic config script
|
# Copy the dynamic config script
|
||||||
COPY ./docker/dynamic-config.sh /docker-entrypoint.d/99-dynamic-config.sh
|
COPY ./docker/dynamic-config.sh /docker-entrypoint.d/99-dynamic-config.sh
|
||||||
|
# And the bundled config file
|
||||||
|
COPY --from=builder /config.json.bundled /config.json.bundled
|
||||||
|
|
||||||
# Copy the built app from the first build stage
|
# Copy the built app from the first build stage
|
||||||
COPY --from=builder /app/target /usr/share/nginx/html
|
COPY --from=builder /app/target /usr/share/nginx/html
|
||||||
|
@ -55,16 +55,18 @@ Then, start up a container from that image:
|
|||||||
```
|
```
|
||||||
docker run \
|
docker run \
|
||||||
--name hydrogen \
|
--name hydrogen \
|
||||||
--publish 80:80 \
|
--publish 8080:8080 \
|
||||||
hydrogen
|
hydrogen
|
||||||
```
|
```
|
||||||
|
|
||||||
|
n.b. the image is now based on the unprivileged nginx base, so the port is now `8080` instead of `80` and you need a writable `/tmp` volume.
|
||||||
|
|
||||||
You can override the default `config.json` using the `CONFIG_OVERRIDE` environment variable. For example to specify a different Homeserver and :
|
You can override the default `config.json` using the `CONFIG_OVERRIDE` environment variable. For example to specify a different Homeserver and :
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run \
|
docker run \
|
||||||
--name hydrogen \
|
--name hydrogen \
|
||||||
--publish 80:80 \
|
--publish 8080:8080 \
|
||||||
--env CONFIG_OVERRIDE='{
|
--env CONFIG_OVERRIDE='{
|
||||||
"push": {
|
"push": {
|
||||||
"appId": "io.element.hydrogen.web",
|
"appId": "io.element.hydrogen.web",
|
||||||
|
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
# Use config override environment variable if set
|
|
||||||
if [ -n "${CONFIG_OVERRIDE:-}" ]; then
|
if [ -n "${CONFIG_OVERRIDE:-}" ]; then
|
||||||
echo "$CONFIG_OVERRIDE" > /usr/share/nginx/html/config.json
|
# Use config override environment variable if set
|
||||||
|
echo "$CONFIG_OVERRIDE" > /tmp/config.json
|
||||||
|
else
|
||||||
|
# Otherwise, use the default config that was bundled in the image
|
||||||
|
cp /config.json.bundled /tmp/config.json
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user