-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): docker entrypoint with run/webserver capabilities
Add new `cmd.sh` script with case matches for subcommands. This enables the docker contrainer to both serv a webserver and run nvme-spex directly on files. Signed-off-by: Morten B. Rasmussen <m.rasmussen@samsung.com>
- Loading branch information
1 parent
7f18df2
commit 3b3c3af
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
# SPDX-FileCopyrightText: 2023 Samsung Electronics Co., Ltd | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
|
||
app_name=$(basename $0) | ||
|
||
sub_help(){ | ||
echo "Usage: $app_name <subcommand> [options]\n" | ||
echo "Subcommands:" | ||
echo " webserver Start webserver for linting NVMe specifications" | ||
echo " run Run NVMe-Spex" | ||
echo "" | ||
} | ||
|
||
|
||
subcommand="${1}" | ||
case $subcommand in | ||
"" | "-h" | "--help") | ||
sub_help | ||
;; | ||
"run") | ||
shift | ||
echo "Running nvme-spex ${@}" | ||
spex $@ | ||
exit 0 | ||
;; | ||
"webserver") | ||
echo "Webserver starting" | ||
hypercorn --reload --bind 0.0.0.0:8000 spexsrv.application.app:app | ||
exit 0 | ||
;; | ||
*) | ||
echo "Error: '$subcommand' is not a known subcommand." >&2 | ||
echo " Run '$app_name --help' for a list of known subcommands." >&2 | ||
exit 1 | ||
;; | ||
esac |