-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
59 lines (53 loc) · 1.42 KB
/
Copy pathentrypoint.sh
File metadata and controls
59 lines (53 loc) · 1.42 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# ------------------------------------------------------------------
# Title: [Entrypoint Script]
# Version: [1.0.0]
# Author: [Ramon Walther]
#
# Description: Simple entrypoint for our frontend container
# to install all necessary packages and build
# the frontend container.
# ------------------------------------------------------------------
PREFIX="[Entrypoint Script]"
# Default init procedure
function init() {
echo "$PREFIX Initializing frontend..."
install
build
start
}
# Development init procedure
function noBuildInit() {
echo "$PREFIX Initializing frontend... (No Build Mode)"
install
start
}
# Install only procedure
function install() {
echo "$PREFIX Installing all necessary packages..."
npm i --legacy-peer-deps
}
# Build only procedure
function build() {
echo "$PREFIX Building container..."
npm run build
}
# Start only procedure
function start() {
echo "$PREFIX Starting application..."
npm start
}
# Arguments handling
function main() {
if ([ "$1" != '' ]); then # Check for command line argument
case "$1" in
-skipbuild) noBuildInit ;;
*) echo "$PREFIX Failed: Argument '$1' not found."
exit 1 ;;
esac
else # No argument was given
echo "$PREFIX No arguments given. Running default init procedure..."
init
fi
}
main $1