forked from lukebond/demo-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
appc.sh
executable file
·38 lines (28 loc) · 1.02 KB
/
appc.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
#!/usr/bin/env bash
set -e
if [ "$EUID" -ne 0 ]; then
echo "This script uses functionality which requires root privileges"
exit 1
fi
# Start the build with an empty ACI
acbuild --debug begin
# In the event of the script exiting, end the build
trap "{ export EXT=$?; acbuild --debug end && exit $EXT; }" EXIT
# Name the ACI
acbuild --debug set-name controlplane/demo-api
# Based on alpine
acbuild --debug dep add quay.io/coreos/alpine-sh
# Install nodejs
acbuild --debug run -- apk update
acbuild --debug run -- apk add nodejs
# Copy the app to the ACI & npm install
acbuild --debug copy package.json /app/demo-api/package.json
acbuild --debug run -- /bin/sh -c 'cd /app/demo-api && npm install'
acbuild --debug copy index.js /app/demo-api/index.js
# Add a port for http traffic
acbuild --debug port add http tcp 9000
# Run nodejs with the app
acbuild --debug set-working-directory /app/demo-api
acbuild --debug set-exec -- /usr/bin/node index.js
# Write the result
acbuild --debug write --overwrite demo-api-latest-linux-amd64.aci