-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
51 lines (49 loc) · 1.3 KB
/
.drone.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
kind: pipeline
steps:
- name: Build image
image: docker
environment:
DOCKER_IMAGE_NAME:
from_secret: docker_image_name
commands:
- docker build -t $${DOCKER_IMAGE_NAME} .
volumes:
- name: docker_socket
path: /var/run/docker.sock
- name: Tag image
image: docker
environment:
DOCKER_IMAGE_NAME:
from_secret: docker_image_name
commands:
- docker tag $${DOCKER_IMAGE_NAME} $${DOCKER_IMAGE_NAME}:latest
- docker tag $${DOCKER_IMAGE_NAME} $${DOCKER_IMAGE_NAME}:${CI_BUILD_NUMBER}
volumes:
- name: docker_socket
path: /var/run/docker.sock
- name: Push image
image: docker
environment:
DOCKER_IMAGE_NAME:
from_secret: docker_image_name
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
commands:
- docker login -u $${DOCKER_USERNAME} -p $${DOCKER_PASSWORD}
- docker push $${DOCKER_IMAGE_NAME}
volumes:
- name: docker_socket
path: /var/run/docker.sock
- name: Clean Docker Cache
image: docker
commands:
- docker system prune -f
volumes:
- name: docker_socket
path: /var/run/docker.sock
volumes:
- name: docker_socket
host:
path: /var/run/docker.sock