docker-entrypoint.sh 786 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. set -e
  3. # Populate config directory
  4. if [ -z "$(ls -A /config)" ]; then
  5. cp /app/support/docker/production/config/* /config
  6. fi
  7. # Always copy default and custom env configuration file, in cases where new keys were added
  8. cp /app/config/default.yaml /config
  9. cp /app/support/docker/production/config/custom-environment-variables.yaml /config
  10. find /config ! -user peertube -exec chown peertube:peertube {} \;
  11. # first arg is `-f` or `--some-option`
  12. # or first arg is `something.conf`
  13. if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
  14. set -- npm "$@"
  15. fi
  16. # allow the container to be started with `--user`
  17. if [ "$1" = 'npm' -a "$(id -u)" = '0' ]; then
  18. find /data ! -user peertube -exec chown peertube:peertube {} \;
  19. exec gosu peertube "$0" "$@"
  20. fi
  21. exec "$@"