-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (23 loc) · 1.36 KB
/
Dockerfile
File metadata and controls
30 lines (23 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/python:4-python3.12-appservice
FROM mcr.microsoft.com/azure-functions/python:4-python3.12
# Set up environment variables for Python and Poetry:
# - PYTHONDONTWRITEBYTECODE: Prevents Python from writing pyc files to disc (equivalent to python -B option)
# - PYTHONUNBUFFERED: Prevents Python from buffering stdout and stderr (equivalent to python -u option)
# - POETRY_VIRTUALENVS_IN_PROJECT: Tells Poetry to create the virtual environment in the project folder
# - POETRY_VIRTUALENVS_CREATE: Tells Poetry to create a virtual environment. This ensures that any packages inside the docker image cannot cause
# weird behaviour in the application.
# - POETRY_CACHE_DIR: Allows deleting the cache directory after installing dependencies.
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
POETRY_VIRTUALENVS_CREATE=0 \
POETRY_CACHE_DIR=/tmp/poetry_cache \
AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="$HOME/.local/bin:$PATH"
COPY poetry.lock pyproject.toml ./
RUN poetry install --without dev
COPY ./src /home/site/wwwroot/src
COPY ./host.json /home/site/wwwroot
COPY ./function_app.py /home/site/wwwroot