From a45abf5870fbb29aa2aba481b1c3faedc0ab2303 Mon Sep 17 00:00:00 2001 From: marcsello Date: Mon, 27 Jul 2020 18:18:26 +0200 Subject: [PATCH] Added docker and k8s stuff --- Dockerfile | 14 ++++++++++ .../{cnn_clasifier.py => cnn_classifier.py} | 0 k8s/configmap.yaml | 13 +++++++++ k8s/deployment.yaml | 27 +++++++++++++++++++ requirements.txt | 4 ++- 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Dockerfile rename cnn_classification_service/{cnn_clasifier.py => cnn_classifier.py} (100%) create mode 100644 k8s/configmap.yaml create mode 100644 k8s/deployment.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..906d922 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM registry.kmlabz.com/birbnetes/ai-base-image + +RUN apt update && apt install -y libsndfile1-dev libsndfile1 && apt clean + +ENV PIP_NO_CACHE_DIR=true +ENV TZ Europe/Budapest +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +ADD cnn_classification_service requirements.txt /cnn_classification_service/ +WORKDIR /cnn_classification_service/ + +RUN pip3 install -r requirements.txt + +ENTRYPOINT ["python3", "main.py"] \ No newline at end of file diff --git a/cnn_classification_service/cnn_clasifier.py b/cnn_classification_service/cnn_classifier.py similarity index 100% rename from cnn_classification_service/cnn_clasifier.py rename to cnn_classification_service/cnn_classifier.py diff --git a/k8s/configmap.yaml b/k8s/configmap.yaml new file mode 100644 index 0000000..7e0f199 --- /dev/null +++ b/k8s/configmap.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: cnn-classification-service + labels: + app: cnn-classification-service + namespace: birbnetes +data: + SENTRY_DSN: https://6d243347cf9f4fc6a54759c3eb34e864@sentry.kmlabz.com/8 + RELEASE_ID: luna-k8s + RELEASEMODE: release + PIKA_URL: amqp://user:1wZVQnP5vy@birb-rabbitmq:5672/ + PIKA_EXCHANGE_NAME: "wave" \ No newline at end of file diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml new file mode 100644 index 0000000..83b3bf1 --- /dev/null +++ b/k8s/deployment.yaml @@ -0,0 +1,27 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cnn-classification-service + namespace: birbnetes + labels: + app: cnn-classification-service +spec: + replicas: 1 + selector: + matchLabels: + app: cnn-classification-service + strategy: + type: Recreate + template: + metadata: + labels: + app: cnn-classification-service + spec: + containers: + - image: registry.kmlabz.com/birbnetes/cnn-classification-service + name: cnn-classification-service + envFrom: + - configMapRef: + name: cnn-classification-service + imagePullSecrets: + - name: regcred diff --git a/requirements.txt b/requirements.txt index f544a55..2d4a88f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,6 @@ librosa keras numpy matplotlib -keras_preprocessing \ No newline at end of file +keras_preprocessing +tensorflow +sndfile \ No newline at end of file