4
这就是我如何做一些棉绒测试(eslint)。Gitlab CI/Docker:使用自定义图像作业
linter:
image: ubuntu:16.04
stage: test
tags:
- testing
before_script:
- apt-get update -y
- apt-get install nodejs-legacy -yqq
- apt-get install curl -yqq
- curl https://install.meteor.com/ | sh
- meteor npm install eslint eslint-plugin-react
script:
- ./node_modules/.bin/eslint --ext .js --ext .jsx .
但是,每次测试都需要将软件包安装到Ubuntu镜像,这需要时间。
所以我想构建一个与此确切的图像。我想出了这个Dockerfile:
FROM ubuntu:16.04
RUN apt-get update -y
RUN apt-get install nodejs-legacy -yqq
RUN apt-get install curl -yqq
RUN apt-get clean && apt-get autoclean && apt-get autoremove
RUN curl https://install.meteor.com/ | sh
然后我做
$ docker build -t linter-testing:latest .
这YML文件:
linter:
image: linter-testing:latest
stage: test
tags:
- testing
before_script:
- meteor npm install eslint eslint-plugin-react
script:
- ./node_modules/.bin/eslint --ext .js --ext .jsx .
但它失败,此错误:
ERROR: Job failed: Error response from daemon: repository linter-testing not found: does not exist or no pull access
那么为什么这个图像不存在,al显示我确切的形象......
我不太确定在哪里创建toml文件。 – user3142695
该文件应该在'/ etc/gitlab-runner'中。我用这个信息编辑了答案。 – Jawad
它应该已经存在。您可能需要以root身份编辑它。只需找到'[runners.docker]'部分并添加/修改'pull_policy ='if-not-present'' – Jawad