我正在尝试设置我的项目pom.xml
和 Maven settings.xml
,以自动化生成 Docker 映像并将其推送到我的AWS ECS私有 Docker 存储库的过程。
在我的pom.xml
中,我添加了dockerfile-maven-plugin并将其配置如下:
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>myproject/server</finalName>
<repository>137037344249.dkr.ecr.us-east-2.amazonaws.com/myproject/server</repository>
<tag>${docker.image.tag}</tag>
<serverId>ecs-docker</serverId>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
<buildArgs>
<VERSION>${project.version}</VERSION>
<BUILD_NUMBER>${buildNumber}</BUILD_NUMBER>
<WAR_FILE>${project.build.finalName}.war</WAR_FILE>
</buildArgs>
</configuration>
</plugin>
根据 dockerfile-maven-plugin 给出的说明,我需要为我的 ECS 服务器身份验证添加配置,但我不知道我需要提供什么用户名/密码。我怀疑这是我的 AWS 登录用户/通行证。
<servers>
<server>
<id>ecs-docker</id>
<username>where_to_get_this</username>
<password>where_to_get_this</password>
</server>
</servers>
此外,欢迎以更好的方式自动生成此 Docker 映像/推送到我的仓库的任何建议。