-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·38 lines (34 loc) · 1.36 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash -e
# Container entrypoint to simplify running the production and dev servers.
# Entrypoint conventions are as follows:
#
# - If the container is run without a custom CMD, the service should run as it would in production.
# - If the container is run with the "dev" CMD, the service should run in development mode.
#
# Normally, this means that if the user's source has been mounted as a volume, the server will
# restart on code changes and will inject extra debugging/diagnostics.
#
# - If the CMD is "test" or "lint", the service should run its unit tests or linting.
#
# There is no requirement that unit tests work unless user source has been mounted as a volume;
# test code should not normally be shipped with production images.
#
# - Otherwise, the CMD should be run verbatim.
if [ "$1" = "test" ]; then
# Install standard test dependencies; YMMV
pip --quiet install \
.[test] nose "PyHamcrest<1.10.0" coverage
exec nosetests ${NAME}
elif [ "$1" = "lint" ]; then
# Install standard linting dependencies; YMMV
pip --quiet install \
.[lint] flake8 flake8-print flake8-logging-format flake8-isort
exec flake8 ${NAME}
elif [ "$1" = "typehinting" ]; then
# Install standard type-linting dependencies
pip --quiet install mypy
mypy ${NAME} --ignore-missing-imports
else
echo "Cannot execute $@"
exit 3
fi