我有一个使用Remix App Server模板构建的混音应用程序。我正在尝试使用Azure应用服务构建它。问题是“build”命令会生成一个.cache文件夹,并且只有在复制该文件夹时才有权限问题。目标是在构建部署之后运行“npm run start”。
这是我的YML。
# Node.js Express Web App to Linux on Azure
# Build a Node.js Express app and deploy it to Azure as a Linux web app.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- development
variables:
# Azure Resource Manager connection created during pipeline creation
azureSubscription: <subscription_id>
# Web app name
webAppName: 'remix'
# Environment name
environmentName: 'remix-app'
# Agent VM image name
vmImageName: 'ubuntu-latest'
# PNPM Cache Location
pnpm_config_cache: $(Pipeline.Workspace)/.pnpm-store
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.x'
displayName: 'Install Node.js'
- task: Cache@2
inputs:
key: 'pnpm | "$(Agent.OS)" | pnpm-lock.yaml'
path: $(pnpm_config_cache)
displayName: Cache pnpm
- script: |
corepack enable
corepack prepare pnpm@latest-8 --activate
pnpm config set store-dir $(pnpm_config_cache)
displayName: "Setup pnpm"
- script: |
pnpm install
pnpm run build
displayName: 'pnpm install, build'
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
replaceExistingArchive: true
- upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
artifact: drop
- stage: Deploy
displayName: Deploy stage
dependsOn: Build
condition: succeeded()
jobs:
- deployment: Deploy
displayName: Deploy
environment: $(environmentName)
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: AzureWebApp@1
displayName: 'Azure Web App Deploy: remix'
inputs:
azureSubscription: $(azureSubscription)
appType: webAppLinux
appName: $(webAppName)
runtimeStack: 'NODE|18'
package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
startUpCommand: 'npm run start'
这就是我得到的错误。
1条答案
按热度按时间cnh2zyt31#
我克隆了这个repository,我使用了Node.js React应用程序和Azure Web应用程序,因为react的remix效果更好。
上述方法不包括任何缓存任务或复制文件。但是在你的任务中你可以添加:-
在执行归档任务之前删除该高速缓存文件。
如果您遇到任何与依赖项相关的问题,请确保通过npm命令更新这些包。首先使用
npm run setup
和npm run dev
命令在本地运行代码。如果应用程序在本地运行,请将代码推送到Azure DevOps管道中,然后再次运行。