Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- docker_config.PNG +0 -0
- docker_container.txt +100 -0
- docker_cost.PNG +0 -0
docker_config.PNG
ADDED
docker_container.txt
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
1- Github pushing files:
|
2 |
+
|
3 |
+
a) just delete any old git folder before create new repo
|
4 |
+
b) cd path/to/your/folder
|
5 |
+
c) git init
|
6 |
+
d) git add .
|
7 |
+
e) git commit -m "First Commit"
|
8 |
+
f) git remote add origin https://github.com/your_username/your_repository_name.git
|
9 |
+
g) git push -u origin master
|
10 |
+
|
11 |
+
2- In Azure:
|
12 |
+
a) go to create resource
|
13 |
+
b) select webapp (name it (resourcegroup,instance)), python 3.8
|
14 |
+
c) pricing plan P1
|
15 |
+
d) next, create
|
16 |
+
|
17 |
+
3- In Azure:
|
18 |
+
a) go to create resource
|
19 |
+
b) select azure bot and create
|
20 |
+
c) select same resourcegroup
|
21 |
+
d) next and create
|
22 |
+
e) go to resource --> configuration --> copy "MicrosoftAppID"/ "Pass"
|
23 |
+
f) open a new tab --> go to app services --> select the resource --> configuration --> new application setting
|
24 |
+
g) Name: MicrosoftAppID, Value: Pass
|
25 |
+
h) in the other tab go to Manage Password, click new secret "name it newsecret" 180 days, copy the value.
|
26 |
+
i) back to the other tab of webapp --> configuration --> new application setting, pass the value, name "MicrosoftAppPassword"
|
27 |
+
j) configuration --> new application setting --> SCM_DO_BUILD_DURING_DEPLOYMENT --> True (value)
|
28 |
+
k) save, and in the same page in general settings,
|
29 |
+
start up command "gunicorn --bind 0.0.0.0 --worker-class aiohttp.worker.GunicornWebWorker --timeout 600 app:APP"
|
30 |
+
|
31 |
+
|
32 |
+
##Container##
|
33 |
+
|
34 |
+
open azurecli and put the below commands:
|
35 |
+
|
36 |
+
# Get the resource group's ID
|
37 |
+
groupId=$(az group show --name myResourceGroup --query id --output tsv)
|
38 |
+
|
39 |
+
# Create the service principal
|
40 |
+
az ad sp create-for-rbac --scope $groupId --role Contributor --sdk-auth
|
41 |
+
|
42 |
+
save the output json credentials
|
43 |
+
|
44 |
+
create new container registery:
|
45 |
+
|
46 |
+
registryId=$(az acr show --name myRegistry --resource-group myResourceGroup --query id --output tsv)
|
47 |
+
|
48 |
+
#az acr show --name <registry-name> --resource-group <resource-group-name> --query id --output tsv
|
49 |
+
|
50 |
+
#az acr show --name myRegistry --resource-group myResourceGroup --query id --output tsv
|
51 |
+
|
52 |
+
lisitng:
|
53 |
+
acr list
|
54 |
+
az acr show
|
55 |
+
az acr list -o table
|
56 |
+
|
57 |
+
az acr show --name botapp2 --resource-group ahmedewispybot --query id --output tsv
|
58 |
+
and i got this, where is the register id?
|
59 |
+
/subscriptions/be2c9f65-de8d-4413-ab92-57d07fd5a256/resourceGroups/ahmedewispybot/providers/Microsoft.ContainerRegistry/registries/botapp2
|
60 |
+
The output you received from the command is actually the registryId you were looking for.
|
61 |
+
|
62 |
+
So in your case, the registryId is:
|
63 |
+
/subscriptions/be2c9f65-de8d-4413-ab92-57d07fd5a256/resourceGroups/ahmedewispybot/providers/Microsoft.ContainerRegistry/registries/botapp2
|
64 |
+
|
65 |
+
|
66 |
+
You can use this registryId directly in the role assignment command to assign a role to a service principal.
|
67 |
+
For example, if you want to assign the AcrPush role to a service principal with the client ID "abcd1234", you would use the following command:
|
68 |
+
|
69 |
+
az role assignment create \
|
70 |
+
--assignee <ClientId> \
|
71 |
+
--scope $registryId \
|
72 |
+
--role AcrPush
|
73 |
+
|
74 |
+
<ClientId> from json file
|
75 |
+
|
76 |
+
|
77 |
+
code example of the role assignment:
|
78 |
+
|
79 |
+
|
80 |
+
az role assignment create --assignee abcd1234 --scope /subscriptions/be2c9f65-de8d-4413-ab92-57d07fd5a256/resourceGroups/ahmedewispybot/providers/Microsoft.ContainerRegistry/registries/botapp2 --role AcrPush
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
https://learn.microsoft.com/en-us/azure/container-instances/container-instances-github-action?tabs=userlevel
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
+
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
|
100 |
+
|
docker_cost.PNG
ADDED