我有一个Dockerfile,试图将一个Web应用程序打包并部署到容器中。在构建Docker镜像时,应用程序的代码从Git存储库中获取。 以下是Dockerfile快照:
........
RUN git clone --depth=1 git-repository-url $GIT_HOME/
RUN mvn package -Dmaven.test.skip
........
我希望 Docker 在构建镜像时不缓存 RUN git clone --depth=1 git-repository-url $GIT_HOME/
步骤,以便正在更新的代码能够反映在镜像中。这是否可行?
ADD https://[USER]:[PASS]@api.bitbucket.org/2.0/repositories/[ORG-NAME]/[REPO-NAME]/commit/[BRANCH] /info RUN git clone --depth 1 --branch [BRANCH] https://[USER]:[PASS]@bitbucket.org/[ORG-NAME]/[REPO-NAME].git /repo
我建议创建一个专门的“集成”用户并使用“应用程序密码”来管理 Bitbucket。https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html 将其与多阶段构建相结合,似乎是目前最完美的解决方案。 - McPADD http://worldtimeapi.org/api/ip /time.tmp
。 - Jayhttps://api.github.com/repos/$USER/$REPO/git/refs/heads/$BRANCH
不再起作用,因为API已经更新。请建议更新后的URL。 - Hemant KumarADD https://gitlab.example.com/api/v4/projects/$PROJECT_ID/repository/branches/$BRANCH_NAME/ version.json
- undefined