# Use an official Python runtime as a parent image
FROM python:3.8-slim
# Set the working directory in the container
WORKDIR /app
# Install Azure Functions Core Tools
RUN apt-get update && \
apt-get install -y apt-transport-https && \
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
echo "deb [arch=amd64] https://packages.microsoft.com/debian/10/prod buster main" > /etc/apt/sources.list.d/microsoft-prod.list && \
apt-get update && \
apt-get install -y azure-functions-core-tools-3
# Install cx_Oracle and any other Python dependencies your function needs
RUN pip install cx-Oracle
# Copy your Azure Functions code into the container
COPY . /app
# Expose the Azure Functions port (default is 7071)
EXPOSE 7071
# Start the Azure Functions host
CMD ["func", "start", "--python"]
Dockerfile 2:-
# Use an official Azure Functions Python runtime image
FROM mcr.microsoft.com/azure-functions/python:3.0
# Install additional OS-level dependencies if needed
# RUN apt-get update && apt-get install -y <package-name>
# Install Python packages
RUN pip install cx-Oracle
# Set environment variables if necessary
# ENV MY_ENV_VAR=value
# Copy the Azure Functions code into the container
COPY . /home/site/wwwroot
# Expose the Azure Functions port (default is 7071)
EXPOSE 7071
# Start the Azure Functions host
CMD [ "azure-functions-core-tools", "host", "start" ]
# Start the Azure Functions host
CMD [ "func", "start" ]
1条答案
按热度按时间3okqufwl1#
带有Oracle客户端和Azure函数的Docker文件示例:-
Dockerfile 2:-