繁体   English   中英

Docker & gitlab-ci:在 Dockerfile 中构建应用程序,同时创建工件

[英]Docker & gitlab-ci: Build application in Dockerfile but also create artifact

I have a Dockerfile which builds my web application and then moves the built application to an nginx folder such that I only have to start the docker image locally and then access my application via localhost (I left out any details because for the moment I don' t认为它们是必要的)。

现在的问题是我还想在 gitlab-ci 管道中创建一个具有相同 Dockerfile 的工件。 这个工件基本上是构建的应用程序,然后稍后处理。

如何将 Dockerimage 中的应用程序文件夹“复制”到 gitlab-ci 环境中?

编辑:我发现

script:
    - docker container create --name dummy ${IMAGE}
    - docker cp dummy:/usr/share/nginx/html web
    - docker rm -f dummy
artifacts:
    paths:
        - web

成为一个解决方案。

我的解决方案:

script:
    - docker container create --name dummy ${IMAGE}
    - docker cp dummy:/usr/share/nginx/html web
    - docker rm -f dummy
artifacts:
    paths:
        - web

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM