首页 > 解决方案 > 用于将 DotNet Core 输出部署到 Firebase 的 Docker 映像

问题描述

我正在努力创建一个 BitBucket Pipeline 脚本,该脚本可以编译 DotNet Core 应用程序,运行它,然后使用 CLI 将输出的 html 文件部署到 Firebase。

image: microsoft/dotnet:sdk

pipelines:
  default:
    - step:
        caches:
          - dotnetcore
        script:
          - dotnet restore
          - dotnet build MySolution.sln
  branches:
    master:
      - step:
           caches:
             - dotnetcore
           script:
            - dotnet restore
            - dotnet build MySolution.sln
            - cd MySolution
            - dotnet run MySolution.
            - npm install -g firebase-tool
            - firebase deploy --token "$FIREBASE_TOKEN"

该图像microsoft/dotnet:sdk不包含我需要的 npm 或 Firebase-Tools 包。我正在努力寻找一个包含 dotnet 和 npm / Firebase-Tools 的替代 Docker 映像。有没有更简单的方法可以直接从 BitBucket 将应用程序的输出部署到 Firebase?

标签: firebasedockerbitbucket-pipelines

解决方案


我认为您应该深入研究 Bitbucket 管道的多步骤方法。在那里,您将能够使用不同的 docker 映像运行每个步骤。

您可以在此处的 Bitbucket 找到更多文档

例如:

pipelines:
  default:
    - step:
        name: Build and test
        image: microsoft/dotnet:sdk
        script:
          - dotnet restore
          - dotnet build
          - dotnet publish -o /out -c Release
        artifacts:
          - out/**
    - step:
        name: Run npm
        image: node:8
        script:
          - npm install -g firebase-tool
          - firebase deploy --token "$FIREBASE_TOKEN"
    - step
        name: Run app
        image: microsoft/dotnet:sdk
        script:
          - dotnet run MySolution .


推荐阅读