Files
Draupnir/draupnir-entrypoint.sh
Gnuxie 5e1563752b
Docker Hub - Develop / docker-latest (push) Failing after 29s
GHCR - Development Branches / ghcr-publish (push) Failing after 30s
Tests / Build & Lint (push) Failing after 4m59s
Tests / Unit tests (push) Successful in 5m59s
Tests / Application Service Integration tests (push) Failing after 14m50s
Tests / Integration tests (push) Failing after 14m56s
Add sourcemaps to entrypoint and normalise paths in the script (#1065)
* Add sourcemaps to entrypoint

* Make entrypoint run Draupnir relative to the script.

This is important for running draupnir from source either directly in
the directory, from ExecStart in systemd, or from inside the docker
image.

And we're making this change so that we can have better control over
the arguments we start Draupnir with in the different environments
without having to make disruptive changes.

Co-authored-by: Bea <20361868+enbea@users.noreply.github.com>

* Add changeset for source installs.

We're gonna write up a proper change log but this is just so we don't forger.

Co-authored-by: Bea <20361868+enbea@users.noreply.github.com>
2026-03-31 15:24:42 +01:00

27 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# SPDX-FileCopyrightText: 2024 Gnuxie <Gnuxie@protonmail.com>
# SPDX-FileCopyrightText: 2022 The Matrix.org Foundation C.I.C.
#
# SPDX-License-Identifier: Apache-2.0
# This is used as the entrypoint in the draupnir Dockerfile and convenience for from-source installations.
# This allows us to set default options for node and to switch between the appservice and bot.
# Help us normalise paths to make sure they are relative to where the script is.
draupnir_path="${0%/*}";
test x"$draupnir_path" = x"$0" && draupnir_path='.';
case "$draupnir_path" in
[!/.]*) draupnir_path="./$draupnir_path";;
esac
case "$1" in
bot) shift; set -- node --enable-source-maps "${draupnir_path}/apps/draupnir/dist/index.js" "$@";;
appservice) shift; set -- node --enable-source-maps "${draupnir_path}/apps/draupnir/dist/appservice/cli.js" "$@";;
esac
# If it looks like someone is providing an executable to `docker run`, then we will execute that instead.
# This aids configuration and debugging of the image if for example node needed to be started via another method,
# Or with different options for node.
exec "$@";