Gitlab CI / Docker: use custom images to work

This is how I do some linter test (eslint).

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 .

But at the same time, each test will have to install packages on the ubuntu image, which takes time.

So, I decided to create an image with this exact. I came up with this 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

Then i do

$ docker build -t linter-testing:latest .

and this yml file:

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 .

But this error fails:

ERROR: Job failed: Error response from daemon: repository linter-testing not found: does not exist or no pull access

So why this image does not exist, althoug docker imagesshows me the exact image ...

+4
source share
1 answer

You need to edit the file config.tomlthat is /etc/gitlab-runneron your machine with the runner, with the following

[runners.docker]
  pull_policy = "if-not-present"

. .

+3

Source: https://habr.com/ru/post/1675088/


All Articles