Skip to content

Commit a4810eb

Browse files
committed
Made image coompatible with streamlit service
1 parent 1dac444 commit a4810eb

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

python38-slim/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ FROM python:3.8-slim
33

44
LABEL maintainer="Viking Analytics AB"
55

6-
ENV BUILDER_VERSION 1.0
6+
ENV BUILDER_VERSION=1.0 \
7+
APP_ROOT="app_root" \
8+
STI_SCRIPTS_PATH=".s2i/bin"
79

810
# Set labels used in OpenShift to describe the builder image
911
LABEL io.k8s.description="Platform for building Daeploy images with reduced size" \

python38-slim/s2i/bin/assemble

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ if [[ "$1" == "-h" ]]; then
1313
fi
1414

1515
echo "---> Installing application source ..."
16-
mv /tmp/src/* "$HOME"
16+
mkdir -p "$APP_ROOT/src"
17+
mv /tmp/src/* "$APP_ROOT/src"
1718

1819
# Install dependencies
1920
echo "---> Upgrading pip and setuptools"
2021
pip install -U pip setuptools
2122

22-
cd $HOME
23+
cd "$APP_ROOT/src"
2324
if [[ -f requirements.txt ]]; then
2425
echo "---> Installing dependencies..."
2526
python -m pip install -r requirements.txt

python38-slim/s2i/bin/run

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md
88
#
99

10-
cd $HOME
10+
cd "$APP_ROOT/src"
1111

1212
if [ -z "$APP_SCRIPT" ] && [ -z "$APP_FILE" ] && [ -z "$APP_MODULE" ]; then
1313
# Set default values for APP_SCRIPT and APP_FILE only when all three APP_
@@ -23,10 +23,8 @@ fi
2323
if [ ! -z "$APP_SCRIPT" ]; then
2424
if [[ -f "$APP_SCRIPT" ]]; then
2525
echo "---> Running application from script ($APP_SCRIPT) ..."
26-
if [[ "$APP_SCRIPT" != /* ]]; then
27-
APP_SCRIPT="$HOME/$APP_SCRIPT"
28-
fi
29-
"$APP_SCRIPT"
26+
chmod +x "./$APP_SCRIPT"
27+
"./$APP_SCRIPT"
3028
elif [[ -z "$APP_SCRIPT_DEFAULT" ]]; then
3129
echo "ERROR: file '$APP_SCRIPT' not found." && exit 1
3230
fi
@@ -35,7 +33,7 @@ fi
3533
if [ ! -z "$APP_FILE" ]; then
3634
if [[ -f "$APP_FILE" ]]; then
3735
echo "---> Running application from Python script ($APP_FILE) ..."
38-
python "$HOME/$APP_FILE"
36+
python "$APP_FILE"
3937
elif [[ -z "$APP_FILE_DEFAULT" ]]; then
4038
echo "ERROR: file '$APP_FILE' not found." && exit 1
4139
fi

0 commit comments

Comments
 (0)