30 lines
768 B
YAML
30 lines
768 B
YAML
|
steps:
|
||
|
- name: build
|
||
|
when:
|
||
|
- branch: main
|
||
|
event: push
|
||
|
- event: tag
|
||
|
image: docker
|
||
|
commands:
|
||
|
- docker build -t $CI_REG_HOST:$CI_REG_PORT/$CI_REPO_OWNER/$CI_REPO_NAME:latest .
|
||
|
volumes:
|
||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||
|
|
||
|
- name: push
|
||
|
when:
|
||
|
- branch: main
|
||
|
event: push
|
||
|
- event: tag
|
||
|
depends_on: build
|
||
|
image: docker
|
||
|
environment:
|
||
|
REG_USER:
|
||
|
from_secret: CI_REG_USER
|
||
|
REG_TOKEN:
|
||
|
from_secret: CI_REG_TOKEN
|
||
|
commands:
|
||
|
- docker login $CI_REG_HOST:$CI_REG_PORT --username $REG_USER --password $REG_TOKEN
|
||
|
- docker push $CI_REG_HOST:$CI_REG_PORT/$CI_REPO_OWNER/$CI_REPO_NAME:latest
|
||
|
volumes:
|
||
|
- /var/run/docker.sock:/var/run/docker.sock
|