Skip to content

Commit 5293e3f

Browse files
committed
Simplify runtime configuration, add python3.6 and python3.7 in cmd.sh
1 parent 89d50ac commit 5293e3f

File tree

2 files changed

+14
-42
lines changed

2 files changed

+14
-42
lines changed

cmd.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
set -e
33

4-
if [ "$RUNTIME" == "python" ] || [ "$RUNTIME" == "python2" ]; then
4+
if [ "$RUNTIME" == "python" ] || [ "$RUNTIME" == "python2" ] || [ "$RUNTIME" == "python2.7" ]; then
55
su $DEFAULT_USER -c "pip install --requirement requirements.txt --upgrade --target ."
6-
elif [ "$RUNTIME" == "python3" ]; then
6+
elif [ "$RUNTIME" == "python3" ] || [ "$RUNTIME" == "python3.6" ] || [ "$RUNTIME" == "python3.7" ]; then
77
su $DEFAULT_USER -c "pip3 install --requirement requirements.txt --upgrade --target ."
88
else
99
su $DEFAULT_USER -c "npm install --production"

entrypoint.sh

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,21 @@
22
set -e
33

44
if [ `whoami` == "root" ]; then
5-
6-
if [ "$RUNTIME" == "" ]; then
7-
echo "Using default runtime node v8"
8-
fi
9-
10-
if [ "$RUNTIME" == "node" ]; then
11-
echo "Using default node v8 runtime"
12-
fi
13-
14-
if [ "$RUNTIME" == "node6" ]; then
15-
echo "Setting node runtime to v6"
5+
if [ "$RUNTIME" == "python" ] || [ "$RUNTIME" == "python2" ] || [ "$RUNTIME" == "python2.7" ]; then
6+
echo "Using python v2.7 runtime"
7+
elif [ "$RUNTIME" == "python3" ] || [ "$RUNTIME" == "python3.7" ]; then
8+
echo "Using python v3.7 runtime"
9+
elif [ "$RUNTIME" == "python3.6" ]; then
10+
echo "Using python v3.6 runtime"
11+
ln -sf /opt/python-${PYTHON_VERSION_3_6}/bin/python3 /usr/bin/python3
12+
ln -sf /opt/python-${PYTHON_VERSION_3_6}/bin/pip3 /usr/bin/pip3
13+
elif [ "$RUNTIME" == "node6" ]; then
14+
echo "Using node v6 runtime"
1615
rm /usr/local/bin/node /usr/local/bin/npm
1716
ln -sf /opt/node-v${NODE_VERSION_6}-linux-x64/bin/node /usr/local/bin/node
1817
ln -sf /opt/node-v${NODE_VERSION_6}-linux-x64/bin/npm /usr/local/bin/npm
19-
fi
20-
21-
if [ "$RUNTIME" == "node8" ]; then
22-
echo "Setting node runtime to v8"
23-
rm /usr/local/bin/node /usr/local/bin/npm
24-
ln -sf /opt/node-v${NODE_VERSION_8}-linux-x64/bin/node /usr/local/bin/node
25-
ln -sf /opt/node-v${NODE_VERSION_8}-linux-x64/bin/npm /usr/local/bin/npm
26-
fi
27-
28-
if [ "$RUNTIME" == "python" ]; then
29-
echo "Using default python v2 runtime"
30-
ln -sf /usr/bin/python2.7 /usr/bin/python2
31-
fi
32-
33-
if [ "$RUNTIME" == "python2" ]; then
34-
echo "Setting python runtime to 2"
35-
ln -sf /usr/bin/python2.7 /usr/bin/python2
36-
fi
37-
38-
if [ "$RUNTIME" == "python3.6" ]; then
39-
echo "Setting python runtime to 3.6"
40-
ln -sf /opt/python-${PYTHON_VERSION_3_6}/bin/python3 /usr/bin/python3
41-
ln -sf f/opt/python-${PYTHON_VERSION_3_6}/bin/pip3 /usr/bin/pip3
42-
fi
43-
44-
if [ "$RUNTIME" == "python3.7" ]; then
45-
echo "Setting python runtime to 3.7"
46-
ln -sf /opt/python-${PYTHON_VERSION_3_7}/bin/python3 /usr/bin/python3
47-
ln -sf /opt/python-${PYTHON_VERSION_3_7}/bin/pip3 /usr/bin/pip3
18+
else
19+
echo "Using node v8 runtime"
4820
fi
4921

5022
if [ "$HOST_UID" != "" ]; then

0 commit comments

Comments
 (0)