Skip to content

Commit c69de36

Browse files
authored
Merge pull request #3 from vikinganalytics/mv-hidden-files
Mv hidden files
2 parents abf4e7d + 04fafb1 commit c69de36

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

python38-slim/Dockerfile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,32 @@ FROM python:3.8-slim
44
LABEL maintainer="Viking Analytics AB"
55

66
ENV BUILDER_VERSION=1.0 \
7-
APP_ROOT="/app_root" \
8-
STI_SCRIPTS_PATH="/.s2i/bin"
7+
APP_ROOT="/opt/app-root" \
8+
HOME="/opt/app-root/src" \
9+
STI_SCRIPTS_PATH="/usr/libexec/s2i"
910

1011
# Set labels used in OpenShift to describe the builder image
11-
LABEL io.k8s.description="Platform for building Daeploy images with reduced size" \
12+
LABEL io.k8s.description="Platform for building lightweight Daeploy images" \
1213
io.k8s.display-name="Daeploy python builder" \
1314
io.openshift.expose-services="8080:http" \
1415
io.openshift.tags="builder,daeploy,python." \
15-
io.openshift.s2i.scripts-url="image://.s2i/bin"
16+
io.openshift.s2i.scripts-url="image://${STI_SCRIPTS_PATH}"
1617

1718
# Setup virtualenv
1819
RUN python -m venv /opt/venv
1920
ENV PATH="/opt/venv/bin:$PATH"
2021

2122
# Copy the S2I scripts to the image
22-
COPY ./s2i/bin/ .s2i/bin
23+
COPY ./s2i/bin/ $STI_SCRIPTS_PATH
2324

24-
# TODO: Set the default port for applications built using this image
25+
# Set the default port for applications built using this image
2526
EXPOSE 8080
2627

27-
# TODO: Set the default CMD for the image
28-
CMD [".s2i/bin/usage"]
28+
# Setup file system
29+
RUN mkdir -p ${APP_ROOT} && \
30+
mkdir -p ${HOME}
31+
32+
WORKDIR $HOME
33+
34+
# Set the default CMD for the image
35+
CMD ["$STI_SCRIPTS_PATH/usage"]

python38-slim/s2i/bin/assemble

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@
99

1010
# If the 'daeploy/s2i-python' assemble script is executed with the '-h' flag, print the usage.
1111
if [[ "$1" == "-h" ]]; then
12-
exec /usr/lib/s2i/usage
12+
exec $STI_SCRIPTS_PATH/usage
1313
fi
1414

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

1919
# Install dependencies
2020
echo "---> Upgrading pip and setuptools"
21-
pip install -U pip setuptools
21+
pip install -U pip
2222

23-
cd "$APP_ROOT/src"
2423
if [[ -f requirements.txt ]]; then
2524
echo "---> Installing dependencies..."
2625
python -m pip install -r requirements.txt

python38-slim/s2i/bin/run

Lines changed: 1 addition & 1 deletion
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 "$APP_ROOT/src"
10+
cd $HOME
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_

0 commit comments

Comments
 (0)