-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathbuild-production.sh
More file actions
executable file
·40 lines (32 loc) · 971 Bytes
/
build-production.sh
File metadata and controls
executable file
·40 lines (32 loc) · 971 Bytes
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
#!/bin/bash
# Builds sources in production
#
# We want to compare the used sources from the one available in /app
# so we can warn at runtime in case developers accidentally mount
# sources without setting the development environment variable.
source ./helpers.sh
# Copy sources from /app to where they can be built
cd /usr/src/app
rm -rf ./app /app.original
docker-rsync --delete --exclude node_modules /app/ /usr/src/app/app/
mkdir -p /config /config.original
if [[ "$(ls -A /app/config/ 2> /dev/null)" ]]
then
cp -r /app/config/* /config.original/
cp -r /app/config/* /config/
fi
cp -r /app /app.original
# Install custom packages if need be
# Determine npm command and install dependencies
if [ -f /app/package.json ]
then
if [ -f /app/package-lock.json ]
then
npm_install_command=ci
else
npm_install_command=install
fi
fi
./npm-install-dependencies.sh production $npm_install_command
./validate-package-json.sh
./transpile-sources.sh