簡體   English   中英

通過 Azure DevOps 管道部署的 Azure Function 未執行

[英]Azure Function deployed via Azure DevOps pipeline not executing

我已經創建了一個 azure 管道來部署一個自定義的 docker 鏡像,它帶有一個帶有以下配置的 azure 函數。 雖然配置在構建方面有效,但沒有任何功能在服務器上運行,我注意到在日志中沒有檢測到任何功能。

pool:
  name: Azure Pipelines
steps:
- task: Docker@1
  displayName: 'build: build the docker image'
  inputs:
    azureSubscriptionEndpoint: 'Azure subscription 1 (3fc75102-5159-4491-b61c-b3fcb845f648)'
    azureContainerRegistry: whaiiapp.azurecr.io
    imageName: 'azureapp.azurecr.io/puppeteer:$(Build.BuildId)'
    useDefaultContext: false

- task: Docker@1
  displayName: 'push the image'
  inputs:
    azureSubscriptionEndpoint: 'Azure subscription 1 (3fc75102-5159-4491-b61c-b3fcb845f648)'
    azureContainerRegistry: azureapp.azurecr.io
    command: 'Push an image'
    imageName: 'azureap.azurecr.io/puppeteer:$(Build.BuildId)'

- task: FuncToolsInstaller@0
  displayName: 'Install func tools - latest'

- task: AzureFunctionAppContainer@1
  displayName: 'Start Azure Function App on Container Deploy: generate-report-dev'
  inputs:
    azureSubscription: 'Azure subscription 1 (3fc75102-5159-4491-b61c-b3fcb845f648)'
    appName: 'generate-report-dev'
    imageName: azureapp.azurecr.io/puppeteer
    containerCommand: 'npm start'

以下是我的 Dockerfile 配置

FROM mcr.microsoft.com/azure-functions/node:3.0-appservice

# Chromium dependencies
RUN apt-get update -yq \
&& apt-get install -yq git git-extras gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst libgbm-dev \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget && \
wget https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64.deb && \
dpkg -i dumb-init_*.deb && rm -f dumb-init_*.deb && \
apt-get clean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*

WORKDIR /home/site/wwwroot

RUN npm install --no-save puppeteer

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true \
    FUNCTIONS_WORKER_RUNTIME=node \

COPY . /home/site/wwwroot

RUN cd /home/site/wwwroot && npm install

CMD [ "npm start" ]

我不確定如何進行調試。 我嘗試通過 ssh 登錄服務器並運行 func start 來測試它,它顯示 func 命令不可用。

我相信您的 azure 函數無法從您的注冊表中提取圖像,我確實遇到了同樣的問題,所以我只是創建了新的函數應用程序,然后在部署過程中選擇了存儲庫,因此它將在幕后創建一個 webhook,每次更新時,都會從注冊表中提取最新的映像。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM