Commit 21fa1573 authored by Sigmund Augdal's avatar Sigmund Augdal

Make it easier to make custom docker based jobs

This is done by setting image in the .docker job and moving the commands to initialize registry access to a before_script there. Then jobs that want's to use docker only need to extend .docker and start using docker commands in scripts
parent 60e81176
......@@ -6,13 +6,14 @@ variables:
services:
- name: docker:stable-dind
command: [ "dockerd", "--host=tcp://0.0.0.0:2375" ]
image: docker:stable
before_script:
- mkdir -p "$HOME/.docker"
- echo -n "$DOCKER_AUTH_CONFIG" >"$HOME/.docker/config.json"
.docker-build:
extends: .docker
image: docker:stable
script:
- mkdir -p "$HOME/.docker"
- echo -n "$DOCKER_AUTH_CONFIG" >"$HOME/.docker/config.json"
- docker build -t "$CI_REGISTRY_IMAGE:$CI_REGISTRY_TAG" --label "no.uninett.scm.commit_sha=${CI_COMMIT_SHA}" --label "no.uninett.scm.pipeline_id=${CI_PIPELINE_ID}" --label "no.uninett.scm.project_url=${CI_PROJECT_URL}" "${BUILD_DIR:-.}"
- docker push "$CI_REGISTRY_IMAGE:$CI_REGISTRY_TAG"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment