Theme not deploying to Azure

Hi,

I’m running my streamlit app deployed to MS Azure in a Web App instance. I’m running into an issue where my theme works fine when run locally, but is not shown in the deployed app.

  • I have a set theme with a config.toml in the .streamlit folder in the root of my project.
  • the .streamlit folder is correctly pushed to github
  • build logs confirm the .streamlit folder is included before uploading the artifact

The app is only intended for colleagues within my organisation so it’s not public. My requirements and .yml are included below.

# requirements.txt
streamlit
requests
pandas
openpyxl
azure-storage-blob
dotenv
# main_rispy.yml 
name: Build and deploy Python app to Azure Web App - rispy

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read

    steps:
      - name: Checkout Git repository
        uses: actions/checkout@v4

      - name: Confirm files exist after checkout
        run: |
          echo "Files after checkout:"
          ls -a

      - name: Set up Python version
        uses: actions/setup-python@v5
        with:
          python-version: '3.13'

      - name: Create and start virtual environment
        run: |
          python -m venv venv
          source venv/bin/activate
      
      - name: Isolate and install dependencies
        run: |
          echo "Installing non-streamlit packages..."
          pip install requests pandas openpyxl azure-storage-blob python-dotenv
          
          echo "---"
          echo "Files after installing other packages:"
          ls -a
          
          echo "---"
          echo "Installing streamlit..."
          pip install streamlit
          
          echo "---"
          echo "Files after installing streamlit:"
          ls -a

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: python-app
          path: |
            .
            !venv/

  deploy:
    runs-on: ubuntu-latest
    needs: build
    
    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v4
        with:
          name: python-app
      
      - name: 'Deploy to Azure Web App'
        uses: azure/webapps-deploy@v3
        id: deploy-to-webapp
        with:
          app-name: 'rispy'
          slot-name: 'Production'
          publish-profile:

Regards,


Solved

The solution I found is to perform a local build within GitHub Actions. This means the workflow will install the dependencies and package them together with your code into a single .zip file. This package has everything it needs to run, and Azure doesn’t have to build anything.

# build.yaml
name: Build and deploy Python app to Azure Web App - rispy

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout Git repository
        uses: actions/checkout@v4

      - name: Set up Python version
        uses: actions/setup-python@v5
        with:
          python-version: '3.13'

      - name: Install dependencies
        run: |
          python -m venv venv
          source venv/bin/activate
          pip install --upgrade pip
          pip install -r requirements.txt

      - name: Zip the application for deployment
        run: |
          zip -r release.zip . -x ".git/*" ".github/*" "venv/*" "__pycache__/*"

      - name: 'Deploy to Azure Web App'
        uses: azure/webapps-deploy@v3
        with:
          app-name: 'rispy'
          slot-name: 'Production'
          publish-profile: ${{ secrets.secret}}
          package: 'release.zip'
1 Like