Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/docker-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Docker CI Pipeline
run-name: ${{ github.actor }} is running out Docker CI Pipeline 🚀
on: [push]
jobs:
hello-world-job:
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v6
- name: Build the image
run: docker build -t ${{ vars.DOCKERHUB_USERNAME }}/helloworld-demo-python:v1 .
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push the image
run: docker push ${{ vars.DOCKERHUB_USERNAME }}/helloworld-demo-python:v1
- name: Run the container
run: docker run --name helloworld-demo-python -itd -p 8080:8080 ${{ vars.DOCKERHUB_USERNAME }}/helloworld-demo-python:v1
- name: View the container
run: docker ps
21 changes: 21 additions & 0 deletions Deployment/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world-deployment
labels:
app: hello-world-python
spec:
replicas: 7
selector:
matchLabels:
app: hello-world-python
template:
metadata:
labels:
app: hello-world-python
spec:
containers:
- name: hello-world-python
image: nithishkumarrn/helloworld-demo-python:v1
ports:
- containerPort: 8080
21 changes: 21 additions & 0 deletions Deployment/k8s-implementation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
k8s-implementation:
needs: docker-build-push
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v6

- name: Start minikube
uses: medyagh/setup-minikube@latest
- name: Try the cluster!
run: kubectl get pods -A

- name: Create Deployment and Service
run: |
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl wait --for=condition=ready pod -l app=hello-world-python
- name: View Deployment and Service
run: |
kubectl get deployments
kubectl get service
11 changes: 11 additions & 0 deletions Deployment/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app.kubernetes.io/hello-world-python: MyApp
ports:
- protocol: TCP
port: 8080
targetPort: 8080
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.14.2-alpine3.22
LABEL version="1.0"
MAINTAINER SanthoshNC
ENV MY_APP="hello-world-python from Nithish Kumar R N"
RUN mkdir /app
WORKDIR /app
COPY . /app
EXPOSE 8080
CMD ["python3", "app.py"]
23 changes: 23 additions & 0 deletions Terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.92"
}
}

required_version = ">= 1.2"
}

provider "aws" {
region = "us-east-1"
}

resource "aws_instance" "app_server" {
ami = "ami-0ecb62995f68bb549"
instance_type = "t2.micro"

tags = {
Name = "learn-terraform"
}
}
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def do_GET(self):
\____\_______/


Hello from Docker!
Hello from Docker This is Nithish Kumar R N !!
''')

def run():
Expand Down