1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-10 15:47:32 +00:00
bramw_baserow/web-frontend/docker/docker-entrypoint.sh

69 lines
1.6 KiB
Bash

#!/bin/bash
# Bash strict mode: http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
show_help() {
# If you change this please update ./docs/reference/baserow-docker-api.md
echo """
Usage: docker run [-T] baserow_web-frontend[_dev] COMMAND
Commands
dev : Start a normal nuxt development server
local : Start a non-dev prod ready nuxt server
lint : Run all the linting
lint-fix : Run eslint fix
stylelint: Run stylelint
eslint : Run eslint
test : Run jest tests
ci-test : Run ci tests with reporting
bash : Start a bash shell
exec : Exec a command directly
help : Show this message
"""
}
case "$1" in
dev)
CMD="yarn run dev"
echo "$CMD"
# The below command lets devs attach to this container, press ctrl-c and only
# the server will stop. Additionally they will be able to use bash history to
# re-run the containers run server command after they have done what they want.
exec bash --init-file <(echo "history -s $CMD; $CMD")
;;
local)
exec yarn run start
;;
lint)
exec make lint-javascript
;;
lint-fix)
CMD="yarn run eslint --fix"
echo "$CMD"
exec bash --init-file <(echo "history -s $CMD; $CMD")
;;
eslint)
exec make eslint
;;
stylelint)
exec make eslint
;;
test)
exec make jest
;;
ci-test)
exec make ci-test-javascript
;;
exec)
exec "${@:2}"
;;
bash)
exec /bin/bash "${@:2}"
;;
*)
echo "${@:2}"
show_help
exit 1
;;
esac