Skip to content

Commit

Permalink
added new jenkinsfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwembo committed Apr 17, 2024
1 parent 04cf281 commit 56967cc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
20 changes: 19 additions & 1 deletion deployments/Jenkins/JenkinsfileEKS
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,31 @@ pipeline {
steps {
script {
// Push your Docker image to the registry
docker.withRegistry(DOCKER_REGISTRY_URL, 'docker-credentials-id') {
docker.withRegistry(DOCKER_REGISTRY_URL, 'globaldockerhub') {
docker.image("${DOCKER_REGISTRY_URL}/${APP_NAME}:${DOCKER_IMAGE_TAG}").push()
}
}

}
}

stage('Create EKS Cluster') {
steps {
script {
sh "eksctl create cluster - name mycluster - nodegroup-name ng-test - node-type t3.medium - nodes 2"

}
}
}

stage('update-kubeconfig') {
steps {
script {
sh "aws eks --region us-east-1 update-kubeconfig --name mycluster"

}
}
}

stage('Deploy to EKS') {
steps {
Expand Down
4 changes: 2 additions & 2 deletions deployments/deploy-aws-eks-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ NAMESPACE="cloudapp-django-web"
DOCKER_IMAGE="joelwembo/cloudapp-django-web:latest"
DEPLOYMENT_NAME="cloudapp-django-web"
SERVICE_NAME="mycluster"
PORT=80
PORT=8585

# Set KUBECONFIG environment variable
export KUBECONFIG="$KUBECONFIG"
Expand All @@ -18,4 +18,4 @@ kubectl apply -f deployments/k8s/deployment.yaml
kubectl set image deployment/$DEPLOYMENT_NAME $DEPLOYMENT_NAME=$DOCKER_IMAGE -n $NAMESPACE

# Expose the deployment as a service
kubectl expose deployment cloudapp-django-web --type=LoadBalancer --port=80 --target-port=8585-n $NAMESPACE --name=cloudapp-django-web
kubectl expose deployment $DEPLOYMENT_NAME --type=LoadBalancer --port=80 --target-port=$PORT -n $NAMESPACE --name=cloudapp-django-web

0 comments on commit 56967cc

Please sign in to comment.