Skip to content

Commit 45001eb

Browse files
Kalyan Reddy DaidaKalyan Reddy Daida
Kalyan Reddy Daida
authored and
Kalyan Reddy Daida
committed
Welcome to Stack Simplify
1 parent d65e76a commit 45001eb

File tree

379 files changed

+16025
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

379 files changed

+16025
-2
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/ADDITIONAL-TOPICS
2+
#/FUTURE-TOPICS
3+
#.gitignore
4+
5+
# macOS Files
6+
.DS_Store
7+
8+
# Ignore .sh files
9+
#*.sh
10+
11+
# Terraform Files and Folders
12+
.terraform
13+
*.tfstate
14+
*.tfstate.backup
15+
*.tfvars
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# Modify for your environment.
4+
# ACR_NAME: The name of your Azure Container Registry
5+
# SERVICE_PRINCIPAL_NAME: Must be unique within your AD tenant
6+
#ACR_NAME=<container-registry-name>
7+
ACR_NAME=acrdemo2ss
8+
SERVICE_PRINCIPAL_NAME=acr-sp-demo
9+
10+
# Obtain the full registry ID for subsequent command args
11+
ACR_REGISTRY_ID=$(az acr show --name $ACR_NAME --query id --output tsv)
12+
13+
# Create the service principal with rights scoped to the registry.
14+
# Default permissions are for docker pull access. Modify the '--role'
15+
# argument value as desired:
16+
# acrpull: pull only
17+
# acrpush: push and pull
18+
# owner: push, pull, and assign roles
19+
SP_PASSWD=$(az ad sp create-for-rbac --name http://$SERVICE_PRINCIPAL_NAME --scopes $ACR_REGISTRY_ID --role acrpull --query password --output tsv)
20+
SP_APP_ID=$(az ad sp show --id http://$SERVICE_PRINCIPAL_NAME --query appId --output tsv)
21+
22+
# Output the service principal's credentials; use these in your services and
23+
# applications to authenticate to the container registry.
24+
echo "Service principal ID: $SP_APP_ID"
25+
echo "Service principal password: $SP_PASSWD"

19-Azure-DevOps-with-AKS/19-01-Azure-DevOps-BuildandPush-to-ACR/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Understand Azure Pipelines
66
- Implement a pipeline to Build and Push Docker Image to Azure Container Registry
77

8-
[![Image](https://www.stacksimplify.com/course-images/azure-devops-pipelines-build-and-push-docker-image-to-acr.png "Azure AKS Kubernetes - Masterclass")](https://www.udemy.com/course/aws-eks-kubernetes-masterclass-devops-microservices/?referralCode=257C9AD5B5AF8D12D1E1)
8+
[![Image](https://www.stacksimplify.com/course-images/azure-devops-pipelines-build-and-push-docker-image-to-acr.png "Azure AKS Kubernetes - Masterclass")](https://www.stacksimplify.com/course-images/azure-devops-pipelines-build-and-push-docker-image-to-acr.png)
99

1010
## Step-02: Create Github Project and Check-In Code
1111
- Create a Github Repo with Name: azure-aks-app1-github-dockerhub
@@ -40,7 +40,7 @@ https://github.com/stacksimplify/azure-aks-app1-github-dockerhub
4040
```
4141

4242

43-
## Step-03: (PENDING) Review github checked-in files
43+
## Step-03: Review github checked-in files
4444
- kube-manifests
4545
- pipeline-backup-files
4646
- Dockerfile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Docker
2+
# Build and push an image to Azure Container Registry
3+
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
4+
5+
trigger:
6+
- master
7+
8+
resources:
9+
- repo: self
10+
11+
variables:
12+
# Container registry service connection established during pipeline creation
13+
dockerRegistryServiceConnection: 'd9a595c8-a457-496a-8aff-13156fd2693a'
14+
imageRepository: 'app1nginxaks'
15+
containerRegistry: 'acrforaksdemo1.azurecr.io'
16+
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
17+
tag: '$(Build.BuildId)'
18+
19+
# Agent VM image name
20+
vmImageName: 'ubuntu-latest'
21+
22+
stages:
23+
- stage: Build
24+
displayName: Build and push stage
25+
jobs:
26+
- job: Build
27+
displayName: Build
28+
pool:
29+
vmImage: $(vmImageName)
30+
steps:
31+
- task: Docker@2
32+
displayName: Build and push an image to container registry
33+
inputs:
34+
command: buildAndPush
35+
repository: $(imageRepository)
36+
dockerfile: $(dockerfilePath)
37+
containerRegistry: $(dockerRegistryServiceConnection)
38+
tags: |
39+
$(tag)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM nginx
2+
COPY index.html /usr/share/nginx/html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body style="background-color:rgb(199, 240, 231);">
4+
<h1>Welcome to Stack Simplify - Azure DevOps - V1</h1>
5+
<h2>Azure DevOps Demo</h2>
6+
<h2>Application Version: V1</h2>
7+
</body>
8+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: app1-nginx-deployment
5+
labels:
6+
app: app1-nginx
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: app1-nginx
12+
template:
13+
metadata:
14+
labels:
15+
app: app1-nginx
16+
spec:
17+
containers:
18+
- name: app1-nginx
19+
image: stacksimplify/aks-github-dockerhub-nginxapp
20+
ports:
21+
- containerPort: 80
22+
---
23+
apiVersion: v1
24+
kind: Service
25+
metadata:
26+
name: app1-nginx-loadbalancer-service
27+
labels:
28+
app: app1-nginx
29+
spec:
30+
type: LoadBalancer
31+
selector:
32+
app: app1-nginx
33+
ports:
34+
- port: 80
35+
targetPort: 80
36+
37+
38+

0 commit comments

Comments
 (0)