I have a python app run in streamlit deployed from github to azure app services. I need to run wkhtmltopdf because of pdfkit, but even i did put it in installation file actions in github, and got success installation, there is no wkhtmltopdf on azure it seems. How to fix this issue? I vahe B1 plan on app services. and it runs on linux
Here is the deployment file:
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions
name: Build and deploy Python app to Azure Web App - positive-test-msal
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python version
uses: actions/setup-python@v1
with:
python-version: '3.11'
- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt
# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v2
with:
name: python-app
path: |
!venv/
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: python-app
path: .
- name: Install wkhtmltopdf
run: sudo apt-get install wkhtmltopdf # Install wkhtmltopdf in the deployment step
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: 'positive-test-msal'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILExxxxx }}
Adding to Sedat SALMAN suggestions - Just to confirm, are you leveraging Azure App Service or App Service Environment?
For your reference, you may checkout this GitHub repo (personal) from one of my colleague: Using wkhtmltopdf (dinktopdf) with Docker and Azure App Service -This repo demonstrates how to use DinkToPdf which is a Nuget package that acts as a wrapper around the very popular wkhtmltopdf library to provide HTML to PDF generation capabilities.
Refer App Service Sandbox GitHub wiki (official): pdf-generation-from-html (sandbox restrictions) and Unsupported frameworks
As a side note -Windows Containers on Azure App Service -many PDF generation libraries make calls to graphics device interface (GDI) APIs, within a Windows container these calls will succeed.
It looks like you're trying to install wkhtmltopdf on the GitHub Actions runner, but this does not make it available in the Azure App Service environment. To resolve this issue, you need to ensure that the wkhtmltopdf executable is available within the Azure App Service environment where your application runs.