Moved old root repository files.

This commit is contained in:
2026-04-20 07:25:31 +02:00
parent 85dd574991
commit 5561f10958
3 changed files with 0 additions and 0 deletions

46
app-streamlit/README.md Normal file
View File

@@ -0,0 +1,46 @@
# Azure Image Chooser
Azure Image Chooser is a [Streamlit](https://streamlit.io) application that allows users to select Azure VM images from the Azure Marketplace.
Azure Image Chooser is written in Python and requires Python interpreter. At the time of writing this, Python 3.13 is the latest.
You can run it on your local machine or deploy to any platform that runs containers. A Docker file and Terraform code to deploy to the Azure are provided.
## Running on a local machine
Create a Python development environment file `.env`:
```shell
AZURE_SUBSCRIPTION_ID="subscription_id"
AZURE_CLIENT_ID="client_id"
AZURE_CLIENT_SECRET="client_secret"
AZURE_TENANT_ID="tenant_id"
AZURE_LOCATION="westeurope"
```
> NOTE: Replace the placeholder values with your actual values. Omit `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, and `AZURE_TENANT_ID` if you are using Azure CLI authentication.
Execute the following commands to run the app:
```shell
python3 -m venv .venv
source .venv/bin/activate
python -m pip install pip --upgrade
pip install -r requirements.txt
cd app
streamlit run image-chooser.py
```
The app will block terminal and start a web server. Follow the instructions in the terminal to access the app.
## Add Certificate Binding for Azure Deployment
Unfortunately, as of now, the Terraform Azure Resource Manager Provider does not support binding certificates to container apps. You can still bind the certificate using the Azure CLI.
```shell
# Find the certificate name
CERTIFICATE_LOWERCASE_NAME=$(az containerapp env certificate list -g $RESOURCE_GROUP -n $ENVIRONMENT --query '[].name' -o tsv)
# Bind the certificate to the container app
az containerapp hostname bind --hostname $DOMAIN_NAME -g $RESOURCE_GROUP -n $CONTAINER_APP --environment $ENVIRONMENT --certificate $CERTIFICATE_LOWERCASE_NAME --validation-method CNAME
```

14
app-streamlit/build.sh Executable file
View File

@@ -0,0 +1,14 @@
#!//usr/bin/env bash
IMAGE_NAME="azure-image-chooser"
IMAGE="docker.io/skoszewski/$IMAGE_NAME:latest"
# IMAGE="skdomlab.azurecr.io/$IMAGE_NAME"
if command -v docker > /dev/null; then
docker buildx build -t $IMAGE app
elif command -v container > /dev/null; then
container build -t $IMAGE app
else
echo "No suitable container tool found"
exit 1
fi

37
app-streamlit/run-container.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/azure.env" ]; then
source "$SCRIPT_DIR/azure.env"
fi
REQUIRED_VARS=("AZURE_CLIENT_ID" "AZURE_TENANT_ID" "AZURE_CLIENT_SECRET" "AZURE_SUBSCRIPTION_ID")
for VAR in "${REQUIRED_VARS[@]}"; do
if [ -z "${!VAR}" ]; then
echo "Environment variable $VAR is not set."
exit 1
fi
done
IMAGE_NAME="azure-image-chooser"
IMAGE="docker.io/skoszewski/$IMAGE_NAME:latest"
RUN_ARGS=(
"--env" "AZURE_CLIENT_ID=$AZURE_CLIENT_ID"
"--env" "AZURE_TENANT_ID=$AZURE_TENANT_ID"
"--env" "AZURE_CLIENT_SECRET=$AZURE_CLIENT_SECRET"
"--env" "AZURE_SUBSCRIPTION_ID=$AZURE_SUBSCRIPTION_ID"
"-p" "8501:8501"
)
if command -v docker > /dev/null; then
CMD="docker"
elif command -v container > /dev/null; then
CMD="container"
else
echo "No suitable container tool found"
exit 1
fi
$CMD run --rm -it "${RUN_ARGS[@]}" $IMAGE