Update gitlab-ci configuration
This commit is contained in:
parent
00953f7348
commit
66b5caede2
@ -1,45 +1,23 @@
|
||||
image: docker:latest
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
|
||||
variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
VERSION: latest
|
||||
CACHETAG: build
|
||||
DOCKER_REGISTRY: registry.leenooks.net
|
||||
DOCKER_IMAGE: ${DOCKER_REGISTRY}/${CI_PROJECT_PATH}
|
||||
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
|
||||
VERSIONARCH: ${VERSION}-${ARCH}
|
||||
|
||||
image: docker:latest
|
||||
services:
|
||||
- ${DOCKER_REGISTRY}/leenooks/ci-docker:dind
|
||||
- docker:dind
|
||||
|
||||
before_script:
|
||||
- docker info
|
||||
- docker version
|
||||
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY}
|
||||
- echo "CI_PROJECT_PATH ${CI_PROJECT_PATH} CI_COMMIT_TAG ${CI_COMMIT_TAG} CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME}"
|
||||
- echo "CI_REGISTRY ${CI_REGISTRY} CI_REGISTRY_IMAGE ${CI_REGISTRY_IMAGE} CI ${CI}"
|
||||
- if [ ! -d build-cache ]; then mkdir build-cache; fi
|
||||
- sed -ie s'/https/http/' /etc/apk/repositories
|
||||
- HTTP_PROXY=http://proxy.dege.lan:3128 apk add git curl
|
||||
- docker info && docker version
|
||||
# env|sort
|
||||
# docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" "$CI_SERVER_HOST"
|
||||
- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
|
||||
|
||||
test:
|
||||
stage: test
|
||||
script:
|
||||
- cat /etc/hosts
|
||||
- env|sort
|
||||
- docker build -t ${DOCKER_IMAGE}:${VERSION} .
|
||||
- docker images
|
||||
only:
|
||||
- debug
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- chmod 500 init
|
||||
- docker pull ${DOCKER_IMAGE}:${CACHETAG}
|
||||
- docker build --cache-from ${DOCKER_IMAGE}:${CACHETAG} -t ${DOCKER_IMAGE}:${VERSION} -t ${DOCKER_IMAGE}:${CACHETAG} .
|
||||
- docker push ${DOCKER_IMAGE}:${VERSION}
|
||||
- docker push ${DOCKER_IMAGE}:${CACHETAG}
|
||||
tags:
|
||||
- docker
|
||||
only:
|
||||
- master
|
||||
include:
|
||||
- .gitlab-docker-x86_64.yml
|
||||
|
16
.gitlab-docker-x86_64.yml
Normal file
16
.gitlab-docker-x86_64.yml
Normal file
@ -0,0 +1,16 @@
|
||||
x86_64:build:
|
||||
variables:
|
||||
ARCH: x86_64
|
||||
stage: build
|
||||
script:
|
||||
- if [ -f init ]; then chmod 500 init; fi
|
||||
- ([ -z "$REFRESH" -a -f build-cache/${CI_COMMIT_REF_SLUG} ]) && docker load < build-cache/${CI_COMMIT_REF_SLUG} || true
|
||||
- rm build-cache/* || true
|
||||
- docker build --build-arg HTTP_PROXY=http://proxy.dege.lan:3128 --cache-from ${CI_REGISTRY_IMAGE}:${VERSIONARCH} -t ${CI_REGISTRY_IMAGE}:${VERSIONARCH} .
|
||||
- docker push ${CI_REGISTRY_IMAGE}:${VERSIONARCH}
|
||||
- docker save ${CI_REGISTRY_IMAGE}:${VERSIONARCH} > build-cache/${CI_COMMIT_REF_SLUG}
|
||||
tags:
|
||||
- docker
|
||||
- x86_64
|
||||
only:
|
||||
- master
|
Loading…
Reference in New Issue
Block a user