face_dataction: run docker build via bazel sh_binary
diff --git a/apps/face_detection/BUILD b/apps/face_detection/BUILD
new file mode 100644
index 0000000..364b682
--- /dev/null
+++ b/apps/face_detection/BUILD
@@ -0,0 +1,13 @@
+# TODO(lekva): figure out how to build py_binary with pip dependencies and
+# migrate off of shell script running docker build
+sh_binary(
+ name = "container",
+ srcs = ["container.sh"],
+ data = glob(["*.py"]) + [
+ "Dockerfile",
+ "haarcascade_frontalface_default.xml",
+ ],
+ deps = [
+ "@bazel_tools//tools/bash/runfiles",
+ ],
+)
diff --git a/apps/face_detection/chart/templates/pcloud/Actions.yaml b/apps/face_detection/chart/templates/pcloud/Actions.yaml
index 32b2a99..0b00bb1 100644
--- a/apps/face_detection/chart/templates/pcloud/Actions.yaml
+++ b/apps/face_detection/chart/templates/pcloud/Actions.yaml
@@ -8,8 +8,8 @@
spec:
containers:
- name: detect-faces
- image: giolekva/face-detector:latest
+ image: {{ .Values.image.name }}:{{ .Values.image.tag }}
imagePullPolicy: Always
- command: ["python3", "main.py"]
+ command: ["/face_detector"]
args: [{-{ .PCloudApiAddr }-}, {-{ .ObjectStoreAddr }-}, {-{ .Id }-}]
restartPolicy: Never
diff --git a/apps/face_detection/chart/values.yaml b/apps/face_detection/chart/values.yaml
index 987d303..d722483 100644
--- a/apps/face_detection/chart/values.yaml
+++ b/apps/face_detection/chart/values.yaml
@@ -1,8 +1,4 @@
-replicas: 1
image:
- name: giolekva/minio-importer
+ name: localhost:30500/giolekva/face-detector
tag: latest
pullPolicy: Always
-servicePort: 80
-containerPort: 1234
-pcloudApiAddress: http://api.pcloud.svc:1111/graphql
\ No newline at end of file
diff --git a/apps/face_detection/container.sh b/apps/face_detection/container.sh
new file mode 100755
index 0000000..3797332
--- /dev/null
+++ b/apps/face_detection/container.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# --- begin runfiles.bash initialization ---
+# Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash).
+set -euo pipefail
+if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
+ if [[ -f "$0.runfiles_manifest" ]]; then
+ export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest"
+ elif [[ -f "$0.runfiles/MANIFEST" ]]; then
+ export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST"
+ elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
+ export RUNFILES_DIR="$0.runfiles"
+ fi
+fi
+if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
+ source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash"
+elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
+ source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \
+ "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)"
+else
+ echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash"
+ exit 1
+fi
+# --- end runfiles.bash initialization ---
+
+DOCKERFILE="$(rlocation __main__/apps/face_detection/Dockerfile)"
+
+docker build \
+ --tag=localhost:30500/giolekva/face-detector \
+ --file=$DOCKERFILE \
+ "$(dirname "$DOCKERFILE")"