-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
36 lines (32 loc) · 1.08 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
stages:
- ci
- deploy
- rm
variables:
IMG_NAME: nx-tools
REG_HOST: docker-registry:443/embedded
BUILD_CONTEXT: /locod/docker/nx/
build-ci-docker:
stage: ci
tags:
- docker-build
script:
- docker build -t ${IMG_NAME}_ci:ci-${CI_COMMIT_REF_NAME} --build-arg NX_USERNAME=${NX_USERNAME} --build-arg NX_PERSONAL_ACCESS_TOKEN=${NX_PERSONAL_ACCESS_TOKEN} -f Dockerfile ${BUILD_CONTEXT}
- docker run --rm -u $(id -u):$(id -g) --hostname localhost.localdomain --mac-address 86:8a:dd:8d:51:a8 -t ${IMG_NAME}_ci:ci-${CI_COMMIT_REF_NAME} bash -c 'lmgrd;sleep 1;nxpython --version'
build-deploy:
stage: deploy
tags:
- docker-build
only:
- tags
script:
- docker tag ${IMG_NAME}_ci:ci-${CI_COMMIT_REF_NAME} ${REG_HOST}/${IMG_NAME}:$CI_COMMIT_TAG
- docker image tag ${REG_HOST}/${IMG_NAME}:$CI_COMMIT_TAG ${REG_HOST}/${IMG_NAME}:latest
- docker push ${REG_HOST}/${IMG_NAME}:latest
- docker push ${REG_HOST}/${IMG_NAME}:$CI_COMMIT_TAG
remove-tmp-img:
stage: rm
tags:
- docker-build
script:
- docker image rm ${IMG_NAME}_ci:ci-${CI_COMMIT_REF_NAME}