我构建了一个 docker 镜像,并将其发布到某个组织下的 github 包注册表,并将其链接到特定存储库。但是,我想指定一个不同的自述文件,以显示在我发布的图像下的包注册表中。
目前,显示的自述文件是我的存储库的通用自述文件。有没有办法更改/指定为我的包裹显示哪一个?
我使用https://start.spring.io/创建了一个简单的 Spring Boot 应用程序。现在我想使用 Paketo.io / Cloud Native Build Pack 支持来spring-boot-maven-plugin构建容器映像,并使用 GitHub Actions 将其推送到 GitHub 容器注册表。
我的pom.xml看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>io.jonashackt</groupId>
<artifactId>helloworld</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>helloworld</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>15</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
mvn spring-boot:build-image我成功地使用GitHub Actions …
buildpack spring-boot spring-boot-maven-plugin github-actions github-package-registry
这是一个问答,我已经把我的解决方案放在了答案中。
我是 GitHub Actions beta 和 GitHub Package Registry beta 的一部分。因为我是一个非常懒惰的人,所以我不仅自动化了 npm 包的构建过程,而且我还想自动化它的发布。
为了做到这一点,我不得不面对一些问题:
我正在寻找这与注册表之间的一些比较,有人尝试过两者吗?
为什么我应该使用一个或另一个?
每个注册表的优缺点是什么?
我正在尝试使用 GitLab Maven 包注册表将 GitLab 项目设置为所有其他项目的远程 Maven 存储库。我已将所有依赖项 jar 文件上传到包注册表。所有 jar 文件都已使用 maven 的部署功能上传。我现在尝试将此项目的包注册表设置为所有其他项目的远程 Maven 存储库。包注册表本身的每个单独的工件页面中提供了必要的存储库设置,如下所示:
<repositories>
<repository>
<id>gitlab-maven</id>
<url>https://<gitlab_instance>/api/v4/projects/<project_id>/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>https://<gitlab_instance>/api/v4/projects/<project_id>/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>https://<gitlab_instance>/api/v4/projects/<project_id>/packages/maven</url>
</snapshotRepository>
</distributionManagement>
Run Code Online (Sandbox Code Playgroud)
然而,即使将其添加到其他项目的 pom.xml 中,它们的构建也会因依赖项不可用而失败。似乎该项目的包注册表无法从其他项目访问。我在这里做错了什么?我还需要采取任何其他步骤吗?
dependencies repository maven gitlab github-package-registry
使用公共 NUGET.ORG 包以及我的组织自己的 nuget Github Packages 注册表中的包的项目可以在本地正常恢复,但无法在 Github Action 中执行此操作。以下是操作 yml 的摘录:
name: workflow1
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
packages: write
issues: write
steps:
- name: Check that shit out
uses: actions/checkout@v3
- name: Set that shit up
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.x.x'
- name: Build that shit
run: |
dotnet nuget add source https://nuget.pkg.github.com/myorg/index.json -n github -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
dotnet restore ./project.sln
dotnet …Run Code Online (Sandbox Code Playgroud) github ×2
.net ×1
buildpack ×1
dependencies ×1
gitlab ×1
maven ×1
npm ×1
nuget ×1
repository ×1
spring-boot ×1
verdaccio ×1