我在gitlab注册表上有我的自定义docker映像,该映像具有一个入口点python脚本,该脚本会打印出传递给脚本的参数。
我在测试项目的ci管道中使用此图像。图像已运行,但参数未传递给并打印。通过docker在本地运行时,该容器可以完美运行。我发现我的gitlab ci yml中缺少某些东西。请帮助“”
下面是创建的docker映像。
https://gitlab.com/raiyanyahya/docker-python-version
下面是我正在测试上面图像的项目。
https://gitlab.com/raiyanyahya/test-docker-in-pipline
我尝试过以各种方式更改.gitlab-ci.yml。不起作用。
Dockerfile代码:
FROM python:alpine3.7
COPY . /app
WORKDIR /app
ENTRYPOINT ["python", "test.py"]
使用上图进行项目:
stages:
- build
build:
image: registry.gitlab.com/raiyanyahya/docker-python-version
stage: build
script:
- test
构建通过了,但是我得到了意外的结果: 实际:
Running with gitlab-runner 12.1.0 (de7731dd)
on docker-auto-scale fa6cab46
Using Docker executor with image registry.gitlab.com/raiyanyahya/docker-python-version ...
Authenticating with credentials from job payload (GitLab Registry)
Pulling docker image registry.gitlab.com/raiyanyahya/docker-python-version ...
Using docker image sha256:174111ca904169c5d8e395801d5d0455e127f41dc0a03ae134907157c62bfc08 for registry.gitlab.com/raiyanyahya/docker-python-version ...
Running on runner-fa6cab46-project-13759326-concurrent-0 via runner-fa6cab46-srm-1565485040-e61249f3...
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/raiyanyahya/test-docker-in-pipline/.git/
Created fresh repository.
From https://gitlab.com/raiyanyahya/test-docker-in-pipline
* [new branch] master -> origin/master
Checking out 7c6bdafb as master...
Skipping Git submodules setup
Authenticating with credentials from job payload (GitLab Registry)
The input to the container is sh
done !!
The input to the container is sh
done !!
Job succeeded
预期:
The input to the container is test.