From b17a1214fd8ced936721b746348421e7e8533674 Mon Sep 17 00:00:00 2001 From: Akash Sharma <2akash111998@gmail.com> Date: Tue, 22 Mar 2022 18:17:57 +0530 Subject: [PATCH 1/3] kaniko-added --- docker/Dockerfile => Dockerfile | 16 ++++++++-------- kubernetes/kaniko-executor.yaml | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) rename docker/Dockerfile => Dockerfile (94%) create mode 100644 kubernetes/kaniko-executor.yaml diff --git a/docker/Dockerfile b/Dockerfile similarity index 94% rename from docker/Dockerfile rename to Dockerfile index ce620c2..2f2c1c4 100644 --- a/docker/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM python:3.7 - -RUN mkdir /app -WORKDIR /app -ADD . /app/ -RUN pip install -r requirements.txt - -EXPOSE 5000 +FROM python:3.7 + +RUN mkdir /app +WORKDIR /app +ADD . /app/ +RUN pip install -r requirements.txt + +EXPOSE 5000 CMD ["python", "/app/main.py"] \ No newline at end of file diff --git a/kubernetes/kaniko-executor.yaml b/kubernetes/kaniko-executor.yaml new file mode 100644 index 0000000..94af2c8 --- /dev/null +++ b/kubernetes/kaniko-executor.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Pod +metadata: + name: kaniko +spec: + containers: + - name: kaniko + image: adaverse/kaniko-executor:latest + args: [ "--context=git://github.com/Adaverse/hello-python", + "--destination=adaverse/hello-flask"] # replace with your dockerhub account + volumeMounts: + - name: kaniko-secret + mountPath: /kaniko/.docker + restartPolicy: Never + volumes: + - name: kaniko-secret + secret: + secretName: regcred + items: + - key: .dockerconfigjson + path: config.json + imagePullSecrets: + - name: regcred \ No newline at end of file From 212f7e16fb87ac661a648878d3e90964be504332 Mon Sep 17 00:00:00 2001 From: Akash Sharma <2akash111998@gmail.com> Date: Tue, 22 Mar 2022 18:21:26 +0530 Subject: [PATCH 2/3] dockerfile-updated --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2f2c1c4..c458fd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM python:3.7 RUN mkdir /app WORKDIR /app ADD . /app/ -RUN pip install -r requirements.txt +RUN pip install -r app/requirements.txt EXPOSE 5000 CMD ["python", "/app/main.py"] \ No newline at end of file From 11ffd3cde1c9329de97ba315b4b33848e338fdfc Mon Sep 17 00:00:00 2001 From: Akash Sharma <2akash111998@gmail.com> Date: Tue, 22 Mar 2022 18:46:47 +0530 Subject: [PATCH 3/3] deployment-updated --- Dockerfile | 2 +- kubernetes/deployment.yaml | 41 ++++++++++++++++++++++++++++++++------ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index c458fd6..2bc0dd0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,4 @@ ADD . /app/ RUN pip install -r app/requirements.txt EXPOSE 5000 -CMD ["python", "/app/main.py"] \ No newline at end of file +CMD ["python", "app/main.py"] \ No newline at end of file diff --git a/kubernetes/deployment.yaml b/kubernetes/deployment.yaml index fdaeb8e..5c984e5 100644 --- a/kubernetes/deployment.yaml +++ b/kubernetes/deployment.yaml @@ -12,21 +12,50 @@ spec: type: LoadBalancer +# --- +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: hello-python +# # labels: +# # app: hello-python +# spec: +# replicas: 4 +# selector: +# matchLabels: +# app: hello-python +# version: v1 +# template: +# metadata: +# labels: +# app: hello-python +# spec: +# containers: +# - name: hello-python +# image: hello-python:latest +# imagePullPolicy: Never +# ports: +# - containerPort: 5000 + --- -apiVersion: apps/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: name: hello-python + labels: + app: hello-python spec: - replicas: 4 + replicas: 3 + selector: + matchLabels: + app: hello-python-pod template: metadata: labels: - app: hello-python + app: hello-python-pod spec: containers: - - name: hello-python - image: hello-python:latest - imagePullPolicy: Never + - name: hello-python-pod + image: adaverse/hello-flask:latest ports: - containerPort: 5000