Skip to content
This repository was archived by the owner on Jul 26, 2024. It is now read-only.

Commit 6064f9a

Browse files
committed
Init
0 parents  commit 6064f9a

34 files changed

+3067
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ARG VARIANT=bullseye
2+
ARG VERSION=3.10
3+
FROM --platform=amd64 mcr.microsoft.com/devcontainers/python:${VERSION}-${VARIANT}
4+
5+
RUN export DEBIAN_FRONTEND=noninteractive \
6+
&& apt-get update \
7+
&& apt-get install -y xdg-utils \
8+
&& curl -fsSL https://aka.ms/install-azd.sh | bash \
9+
&& apt-get clean -y \
10+
&& rm -rf /var/lib/apt/lists/*

.devcontainer/devcontainer.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"name": "Azure Developer CLI",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
"VARIANT": "bullseye",
7+
"VERSION": "3.10"
8+
}
9+
},
10+
"features": {
11+
"ghcr.io/devcontainers/features/azure-cli:1": {
12+
"version": "2.48.1"
13+
},
14+
"ghcr.io/devcontainers/features/docker-from-docker:1": {
15+
"version": "20.10"
16+
},
17+
"ghcr.io/devcontainers/features/github-cli:1": {
18+
"version": "2"
19+
}
20+
},
21+
"customizations": {
22+
"vscode": {
23+
"extensions": [
24+
"ms-azuretools.azure-dev",
25+
"ms-azuretools.vscode-bicep",
26+
"ms-azuretools.vscode-docker",
27+
"ms-vscode.vscode-node-azure-pack",
28+
"ms-vscode.js-debug",
29+
"esbenp.prettier-vscode",
30+
"dbaeumer.vscode-eslint",
31+
"ms-azuretools.vscode-azurefunctions",
32+
"github.vscode-github-actions",
33+
"GitHub.copilot-nightly",
34+
"ms-python.black-formatter"
35+
]
36+
},
37+
"codespaces": {
38+
"openFiles": [
39+
"main.py"
40+
]
41+
}
42+
},
43+
"forwardPorts": [
44+
6379,
45+
8000
46+
],
47+
"postAttachCommand": "",
48+
"postCreateCommand": "pip3 install --user -r requirements.txt",
49+
"remoteUser": "vscode",
50+
"hostRequirements": {
51+
"memory": "8gb",
52+
"cpus": 8
53+
},
54+
"portsAttributes": {
55+
"8000": {
56+
"label": "FastAPI Server"
57+
}
58+
}
59+
}

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/workflows/azure-dev.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
on:
2+
workflow_dispatch:
3+
push:
4+
branches:
5+
- main
6+
- just-the-basics
7+
8+
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
container:
17+
image: mcr.microsoft.com/azure-dev-cli-apps:latest
18+
env:
19+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
20+
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
21+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
22+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
23+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
24+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Log in with Azure (Federated Credentials)
30+
if: ${{ env.AZURE_CLIENT_ID != '' }}
31+
run: |
32+
azd auth login `
33+
--client-id "$Env:AZURE_CLIENT_ID" `
34+
--federated-credential-provider "github" `
35+
--tenant-id "$Env:AZURE_TENANT_ID"
36+
shell: pwsh
37+
38+
- name: Log in with Azure (Client Credentials)
39+
if: ${{ env.AZURE_CREDENTIALS != '' }}
40+
run: |
41+
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
42+
Write-Host "::add-mask::$($info.clientSecret)"
43+
44+
azd auth login `
45+
--client-id "$($info.clientId)" `
46+
--client-secret "$($info.clientSecret)" `
47+
--tenant-id "$($info.tenantId)"
48+
shell: pwsh
49+
env:
50+
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
51+
52+
- name: Provision Azure Resources - Azure Container Apps, Container Registry, Azure Monitor, Log Analytics
53+
run: azd provision --no-prompt
54+
env:
55+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
56+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
57+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
58+
59+
- name: Deploy changes to Azure Container Apps
60+
run: azd deploy --no-prompt
61+
env:
62+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
63+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
64+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}

.gitignore

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# environment name
2+
demoplugin/
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
share/python-wheels/
27+
*.egg-info/
28+
.installed.cfg
29+
*.egg
30+
MANIFEST
31+
32+
# PyInstaller
33+
# Usually these files are written by a python script from a template
34+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
35+
*.manifest
36+
*.spec
37+
38+
# Installer logs
39+
pip-log.txt
40+
pip-delete-this-directory.txt
41+
42+
# Unit test / coverage reports
43+
htmlcov/
44+
.tox/
45+
.nox/
46+
.coverage
47+
.coverage.*
48+
.cache
49+
nosetests.xml
50+
coverage.xml
51+
*.cover
52+
*.py,cover
53+
.hypothesis/
54+
.pytest_cache/
55+
cover/
56+
57+
# Translations
58+
*.mo
59+
*.pot
60+
61+
# Django stuff:
62+
*.log
63+
local_settings.py
64+
db.sqlite3
65+
db.sqlite3-journal
66+
67+
# Flask stuff:
68+
instance/
69+
.webassets-cache
70+
71+
# Scrapy stuff:
72+
.scrapy
73+
74+
# Sphinx documentation
75+
docs/_build/
76+
77+
# PyBuilder
78+
.pybuilder/
79+
target/
80+
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# IPython
85+
profile_default/
86+
ipython_config.py
87+
88+
# pyenv
89+
# For a library or package, you might want to ignore these files since the code is
90+
# intended to run in multiple environments; otherwise, check them in:
91+
# .python-version
92+
93+
# pipenv
94+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97+
# install all needed dependencies.
98+
#Pipfile.lock
99+
100+
# poetry
101+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
102+
# This is especially recommended for binary packages to ensure reproducibility, and is more
103+
# commonly ignored for libraries.
104+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105+
#poetry.lock
106+
107+
# pdm
108+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
109+
#pdm.lock
110+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
111+
# in version control.
112+
# https://pdm.fming.dev/#use-with-ide
113+
.pdm.toml
114+
115+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116+
__pypackages__/
117+
118+
# Celery stuff
119+
celerybeat-schedule
120+
celerybeat.pid
121+
122+
# SageMath parsed files
123+
*.sage.py
124+
125+
# Environments
126+
.env
127+
.venv
128+
env/
129+
venv/
130+
ENV/
131+
env.bak/
132+
venv.bak/
133+
134+
# Spyder project settings
135+
.spyderproject
136+
.spyproject
137+
138+
# Rope project settings
139+
.ropeproject
140+
141+
# mkdocs documentation
142+
/site
143+
144+
# mypy
145+
.mypy_cache/
146+
.dmypy.json
147+
dmypy.json
148+
149+
# Pyre type checker
150+
.pyre/
151+
152+
# pytype static type analyzer
153+
.pytype/
154+
155+
# Cython debug symbols
156+
cython_debug/
157+
158+
# PyCharm
159+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
160+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
161+
# and can be added to the global gitignore or merged into this file. For a more nuclear
162+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
163+
#.idea/
164+
165+
166+
.azure

.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: FastAPI",
9+
"type": "python",
10+
"request": "launch",
11+
"module": "uvicorn",
12+
"args": [
13+
"main:app",
14+
"--reload"
15+
],
16+
"jinja": true,
17+
"justMyCode": true
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)