简体   繁体   English

如何挂载卷并将文件复制到 gitlab 中的 docker 容器中?

[英]How to mount a volume and copy a file into docker container in gitlab?

I have the following gitlab-ci.yml file:我有以下 gitlab-ci.yml 文件:

stages: 
  - test_dev
  
Postman_Tests_Dev: 
  stage: test_dev
  image:
    name: postman/newman
    entrypoint: ["/bin/sh", "-c"]
  script:
    - newman --version
  tags:
    - docker-azure

It seems to be working fine in that I can see the newman version number being printed.似乎工作正常,因为我可以看到正在打印的 newman 版本号。 now I need to run a test by doing something like "newman run ".现在我需要通过执行“newman run”之类的操作来运行测试。

Before I do that I, I need to copy my json file from the gitlab repository into the container.在我这样做之前,我需要将我的 json 文件从 gitlab 存储库复制到容器中。 The file lives in./postmantests - relative to the gitlab-ci.yml file.该文件位于 ./postmantests - 相对于 gitlab-ci.yml 文件。 I'm presently googling but I think my keywords are wrong.我目前正在谷歌搜索,但我认为我的关键字是错误的。

what I'd like to see is if there's something like this:我想看看是否有这样的东西:

stages: 
  - test_dev

Postman_Tests_Dev: 
  stage: test_dev
  image:
    name: postman/newman
    entrypoint: ["/bin/sh", "-c"]
    volume: postmantests:/etc/newman
  script:
    - newman --version
    - newman run /etc/newman/myjsontest.json

I don't think this is possible.我不认为这是可能的。 You probably need to build you own image based on postman/newman and add the volume there.您可能需要基于postman/newman构建自己的图像并在那里添加卷。

Afterwards you can use this image in image .之后,您可以在 image 中使用此image

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

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