-
Notifications
You must be signed in to change notification settings - Fork 8
/
entrypoint.sh
executable file
·36 lines (32 loc) · 1.25 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
#!/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 -e .\[test\]
pytest ${NAME}
elif [ "$1" = "lint" ]; then
# Install standard linting dependencies; YMMV
pip --quiet install .\[lint\]
flake8 ${NAME}
elif [ "$1" = "typehinting" ]; then
# Install standard type-linting dependencies
pip --quiet install .\[typehinting\]
mypy ${NAME}
else
echo "Cannot execute $@"
exit 3
fi