2021-03-08 17:02:04 +01:00
|
|
|
## Warning
|
|
|
|
|
2021-02-08 12:43:53 +01:00
|
|
|
Usage of docker is a third-party contribution and not actively tested, used or supported by the main developer(s).
|
|
|
|
|
2021-03-08 17:02:04 +01:00
|
|
|
Having said that, you can also use Docker to create a local dev environment or a production deployment.
|
|
|
|
|
|
|
|
## Dev environment
|
2021-02-08 12:43:53 +01:00
|
|
|
|
|
|
|
In this repository, create a Docker image:
|
|
|
|
|
2021-03-08 17:02:04 +01:00
|
|
|
```
|
|
|
|
docker build -t hydrogen-dev -f Dockerfile-dev .
|
|
|
|
```
|
2021-02-08 12:43:53 +01:00
|
|
|
|
|
|
|
Then start up a container from that image:
|
|
|
|
|
2021-03-08 17:02:04 +01:00
|
|
|
```
|
|
|
|
docker run \
|
|
|
|
--name hydrogen-dev \
|
|
|
|
--publish 3000:3000 \
|
|
|
|
--volume "$PWD":/code \
|
|
|
|
--interactive \
|
|
|
|
--tty \
|
|
|
|
--rm \
|
|
|
|
hydrogen-dev
|
|
|
|
```
|
2021-02-08 12:43:53 +01:00
|
|
|
|
|
|
|
Then point your browser to `http://localhost:3000`. You can see the server logs in the terminal where you started the container.
|
|
|
|
|
|
|
|
To stop the container, simply hit `ctrl+c`.
|
2021-03-08 17:02:04 +01:00
|
|
|
|
|
|
|
## Production deployment
|
|
|
|
|
|
|
|
### Build or pull image
|
|
|
|
|
|
|
|
In this repository, create a Docker image:
|
|
|
|
|
2023-01-19 18:07:55 +01:00
|
|
|
```sh
|
|
|
|
# Enable BuildKit https://docs.docker.com/develop/develop-images/build_enhancements/
|
|
|
|
export DOCKER_BUILDKIT=1
|
2021-03-08 17:02:04 +01:00
|
|
|
docker build -t hydrogen .
|
|
|
|
```
|
|
|
|
|
2023-01-09 19:56:18 +01:00
|
|
|
Or, pull the docker image from GitHub Container Registry:
|
2021-03-08 17:02:04 +01:00
|
|
|
|
|
|
|
```
|
2024-06-22 21:46:14 +02:00
|
|
|
docker pull ghcr.io/element-hq/hydrogen-web
|
|
|
|
docker tag ghcr.io/element-hq/hydrogen-web hydrogen
|
2021-03-08 17:02:04 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
### Start container image
|
|
|
|
|
|
|
|
Then, start up a container from that image:
|
|
|
|
|
|
|
|
```
|
|
|
|
docker run \
|
|
|
|
--name hydrogen \
|
2023-01-20 14:31:14 +01:00
|
|
|
--publish 8080:8080 \
|
2021-03-08 17:02:04 +01:00
|
|
|
hydrogen
|
|
|
|
```
|
2023-01-11 19:06:25 +01:00
|
|
|
|
2023-01-20 18:54:01 +01:00
|
|
|
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.
|
|
|
|
|
2023-01-11 19:06:25 +01:00
|
|
|
You can override the default `config.json` using the `CONFIG_OVERRIDE` environment variable. For example to specify a different Homeserver and :
|
|
|
|
|
|
|
|
```
|
|
|
|
docker run \
|
|
|
|
--name hydrogen \
|
2023-01-20 14:31:14 +01:00
|
|
|
--publish 8080:8080 \
|
2023-01-11 19:06:25 +01:00
|
|
|
--env CONFIG_OVERRIDE='{
|
|
|
|
"push": {
|
|
|
|
"appId": "io.element.hydrogen.web",
|
|
|
|
"gatewayUrl": "https://matrix.org",
|
|
|
|
"applicationServerKey": "BC-gpSdVHEXhvHSHS0AzzWrQoukv2BE7KzpoPO_FfPacqOo3l1pdqz7rSgmB04pZCWaHPz7XRe6fjLaC-WPDopM"
|
|
|
|
},
|
|
|
|
"defaultHomeServer": "https://fosdem.org",
|
|
|
|
"themeManifests": [
|
|
|
|
"assets/theme-element.json"
|
|
|
|
],
|
|
|
|
"defaultTheme": {
|
|
|
|
"light": "element-light",
|
|
|
|
"dark": "element-dark"
|
|
|
|
}
|
|
|
|
}' \
|
|
|
|
hydrogen
|
|
|
|
```
|