A sample of using docker to deploy a Python based app
Перейти к файлу
microsoft-github-policy-service[bot] f55283424d
Auto merge mandatory file pr
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days.
2023-05-31 18:48:31 +00:00
BlobTrigger Renaming samples 2018-03-24 16:11:55 -07:00
CosmosDBTrigger Update README.md 2018-05-03 11:43:58 -07:00
HttpTrigger Renaming samples 2018-03-24 16:11:55 -07:00
QueueTrigger Renaming samples 2018-03-24 16:11:55 -07:00
TimerTrigger Renaming samples 2018-03-24 16:11:55 -07:00
.DS_Store Renaming samples 2018-03-24 16:11:55 -07:00
.gitignore Initial commit 2018-03-07 10:27:52 -08:00
Dockerfile Update Dockerfile 2018-05-02 14:43:50 -07:00
LICENSE Initial commit 2018-03-07 10:27:57 -08:00
README.md Update README.md 2018-05-13 12:16:35 -04:00
SECURITY.md Microsoft mandatory file 2023-01-24 16:40:16 +00:00
host.json modified host.json 2018-03-07 17:27:02 -08:00
requirements.txt Adding the dockerfile and http sample 2018-03-07 10:40:41 -08:00

README.md

This repository hosts the instructions and neccessary artifacts for building and publishing Python Functions as a Docker container on Linux.

For comprehensive information about Python in Azure Functions, refer to the azure-functions-python-worker repo.

Getting Started

Prerequisites

Download the sample

In a terminal window, run the following command to clone the sample app repository to your local machine, then change to the directory that contains the sample code.

git clone https://github.com/Azure/azure-functions-docker-python-sample.git
cd azure-functions-docker-python-sample

Understanding the environment

In the Git repository, take a look at the Dockerfile. This file describes the environment that is required to run Python functions on Linux.

# Base the image on the built-in Azure Functions Python image
FROM microsoft/azure-functions-python3.6:v2.0.11737-alpha

# Add files from this repo to the root site folder.
COPY . /home/site/wwwroot

# Install requirements
RUN cd /home/site/wwwroot && pip install -r requirements.txt

Build and deploy the custom image

To build and test your image locally, and deploy to Azure, follow the instructions here -

Create a function on Linux using a custom image

Configure storage

Azure Functions needs a storage account in order to run locally.

The best way to add this is to create a Storage Account in Azure and pass the connection string as an environment variable called AzureWebJobsStorage to the docker run command.

docker run -p 8080:80 -it -e AzureWebJobsStorage="{connection-string}" <docker-id>/mydockerimage:v1.0.0

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.