Skip to content

Instantly share code, notes, and snippets.

@lastcoolnameleft
Last active August 8, 2019 18:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lastcoolnameleft/05b6b09735fb435b2cb4469f6cf30ac6 to your computer and use it in GitHub Desktop.
Azure Functions Development Dockerfile

Basic Azure Function Development Dockerfile

To build: docker build -t azure-func-dev-env .

To run: docker run -it -v $HOME:/root -p 7071:7071 azure-func-dev-env bash

Example scenario:

docker build --no-cache -t azure-func-dev-env https://gist.githubusercontent.com/lastcoolnameleft/05b6b09735fb435b2cb4469f6cf30ac6/raw/7312df8d2c9c05ebc6f0da029661a6a25750ecf9/Dockerfile

docker run -it -v $HOME:/root -p 7071:7071 azure-func-dev-env bash

cd /root
func init MyFunctionProj
cd MyFunctionProj
func host start
# Go to http://localhost:7071 in browser
FROM ubuntu:bionic
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest#manual-install-instructions
# https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local#linux
RUN apt-get update
RUN apt-get -y install lsb-release ca-certificates curl apt-transport-https lsb-release gnupg libssl1.0.0 libssl-dev python3-distutils python3-pip
# HACk! func looks for pip, not pip3
RUN ln -s /usr/bin/pip3 /usr/bin/pip
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
RUN mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list
RUN apt-get update
RUN apt-get -y install azure-functions-core-tools azure-cli python3.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment