-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into person/aivanov/vdk-control-cli-fix-parsing-c…
…ontacts
- Loading branch information
Showing
4 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
projects/control-service/projects/job-base-image/Dockerfile-data-job-base
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices\ | ||
# Creating data job base image with support for Oracle. | ||
|
||
ARG base_image=python:3.7-slim | ||
FROM $base_image | ||
|
||
# Set the working directory | ||
WORKDIR /job | ||
|
||
|
||
# Install native dependencies so that requirements in requirements.txt can be installed | ||
# some (like openssl) should be pre-installed in the base image but let's be explicit | ||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& apt-get -y install --no-install-recommends \ | ||
build-essential openssl g++ | ||
|
||
# Install the native dependencies necessary for cx_Oracle python library | ||
# See https://oracle.github.io/odpi/doc/installation.html#linux | ||
RUN set -ex \ | ||
&& echo "Installing native dependencies related to support for cx_Oracle python library ..." \ | ||
&& mkdir -p /opt/lib/native \ | ||
&& apt-get -y install --no-install-recommends libaio1 curl unzip \ | ||
&& curl --insecure --output oracle-instantclient.zip https://download.oracle.com/otn_software/linux/instantclient/1911000/instantclient-basic-linux.x64-19.11.0.0.0dbru.zip \ | ||
&& unzip oracle-instantclient.zip -d /opt/lib/native/oracle && rm -f oracle-instantclient.zip \ | ||
&& sh -c "echo /opt/lib/native/oracle/instantclient_19_11 > /etc/ld.so.conf.d/oracle-instantclient.conf" \ | ||
&& ldconfig \ | ||
&& apt-get purge -y --auto-remove curl unzip | ||
|
||
# libaio1 - LGPL-2.1+ https://developer.puri.sm/licenses/Librem5/Birch/libaio1/copyright | ||
# curl - MIT/X* modified https://curl.se/docs/copyright.html | ||
# unzip - MIT https://github.com/vipsoft/Unzip/blob/master/LICENSE | ||
# oracle instant client license - Oracle Technology Network Development and Distribution License Agreement https://www.oracle.com/downloads/licenses/instant-client-lic.html |
17 changes: 17 additions & 0 deletions
17
projects/control-service/projects/job-base-image/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Job base image | ||
|
||
Job base image is the container "base" image used when building per data job custom image during deployment. | ||
|
||
This directory provides the source of some base images for standard python versions. | ||
It's used by default installation of VDK and should also serve as an example on how operators of VDK can build their own base image. | ||
|
||
The current base image installs supporting libraries for Oracle database | ||
and some native bindings necessary for installing from source some python packages which user may specify for their data job. | ||
|
||
## Build | ||
|
||
To build the job_base images run `./publish-job-base` which will publish new base image to versatiledatakit container registry. | ||
|
||
## Use | ||
|
||
It's then set in values.yaml of the helm chart as `deploymentDataJobBaseImage` option |
41 changes: 41 additions & 0 deletions
41
projects/control-service/projects/job-base-image/publish-job-base.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2021 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
VERSION_TAG="${VERSION_TAG:-"0.1dev"}" | ||
VDK_DOCKER_REGISTRY_URL=${VDK_DOCKER_REGISTRY_URL:-"registry.hub.docker.com/versatiledatakit"} | ||
|
||
function build_and_push_image() { | ||
name="$1" | ||
docker_file="$2" | ||
arguments="$3" | ||
|
||
image_repo="$VDK_DOCKER_REGISTRY_URL/$name" | ||
image_tag="$image_repo:$VERSION_TAG" | ||
|
||
docker build -t "$image_tag" -t "$image_repo:latest" -f "$SCRIPT_DIR/$docker_file" $arguments "$SCRIPT_DIR" | ||
docker push "$image_tag" | ||
docker push "$image_repo:latest" | ||
} | ||
|
||
build_and_push_image \ | ||
"data-job-base-python-3.7" \ | ||
Dockerfile-data-job-base \ | ||
"--build-arg base_image=python:3.7-slim" | ||
|
||
build_and_push_image \ | ||
"data-job-base-python-3.8" \ | ||
Dockerfile-data-job-base \ | ||
"--build-arg base_image=python:3.8-slim" | ||
|
||
build_and_push_image \ | ||
"data-job-base-python-3.9" \ | ||
Dockerfile-data-job-base \ | ||
"--build-arg base_image=python:3.9-slim" | ||
|
||
build_and_push_image \ | ||
"data-job-base-python-3.10" \ | ||
Dockerfile-data-job-base \ | ||
"--build-arg base_image=python:3.10-slim" |