-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerstart
executable file
·62 lines (53 loc) · 1.07 KB
/
Dockerstart
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
60
61
62
#!/bin/bash
set -e
BUILD_DIR="/tmp/build"
SRC_DIR="$(pwd)"
DIST_DIR="${SRC_DIR}/dist"
METEOR_PATH=/usr/local/bin/meteor
#
# Clean out any existing dist and build folders
#
echo "=== cleaning folders ==="
if [ -d "${DIST_DIR}" ]
then
rm -rf "${DIST_DIR}"
fi
mkdir -p "${DIST_DIR}"
if [ -d "${BUILD_DIR}" ]
then
rm -rf "${BUILD_DIR}"
fi
mkdir -p "${BUILD_DIR}"
#
# If there's a package.json, run npm install
#
if [ -f "${SRC_DIR}/package.json" ]
then
echo "=== Running npm install before building ==="
pushd ${SRC_DIR}
npm install
popd
fi
#
# Make a temporary folder to hold the built app and run meteor build
#
echo "=== building ==="
pushd "${SRC_DIR}"
"${METEOR_PATH}" build "${BUILD_DIR}" --directory
popd
#
# Run npm install inside the bundle
#
echo "=== Running npm install inside the bundle ==="
pushd "${BUILD_DIR}/bundle/programs/server"
npm install
popd
#
# Copy the finished product back to the ${SRC_DIR}/dist folder
#
echo "=== Copying built app to the dist folder ==="
rsync -a "${BUILD_DIR}/bundle" "${DIST_DIR}"
#
# All done
#
echo "=== Complete ==="