aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/docker/production/entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'support/docker/production/entrypoint.sh')
-rwxr-xr-xsupport/docker/production/entrypoint.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/support/docker/production/entrypoint.sh b/support/docker/production/entrypoint.sh
new file mode 100755
index 000000000..7dd626b9f
--- /dev/null
+++ b/support/docker/production/entrypoint.sh
@@ -0,0 +1,26 @@
1#!/bin/sh
2set -e
3
4# Populate config directory
5if [ -z "$(ls -A /config)" ]; then
6 cp /app/support/docker/production/config/* /config
7fi
8
9# Always copy default and custom env configuration file, in cases where new keys were added
10cp /app/config/default.yaml /config
11cp /app/support/docker/production/config/custom-environment-variables.yaml /config
12find /config ! -user peertube -exec chown peertube:peertube {} \;
13
14# first arg is `-f` or `--some-option`
15# or first arg is `something.conf`
16if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
17 set -- npm "$@"
18fi
19
20# allow the container to be started with `--user`
21if [ "$1" = 'npm' -a "$(id -u)" = '0' ]; then
22 find /data ! -user peertube -exec chown peertube:peertube {} \;
23 exec gosu peertube "$0" "$@"
24fi
25
26exec "$@"