forked from docker-library/php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.star
61 lines (58 loc) · 1.88 KB
/
.drone.star
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
52
53
54
55
56
57
58
59
60
61
# Automatically builds docker images and pushes them to the registry.
# Required drone secrets:
# - docker_repo eg. 'joellinn/php'
# - docker_username user with write permissions to repo
# - docker_password password of the user
def main(ctx):
steps = [
{
'name': 'verify',
'image': 'ubuntu:focal',
'commands': [
'DEBIAN_FRONTEND=noninteractive apt-get update',
'DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl gawk git jq wget xz-utils',
'./apply-templates.sh',
'''
status="$(git status --short)"
echo "$status"
[ -z "$status" ]
''',
]
},
]
steps.extend(steps_56())
return [
{
'kind': 'pipeline',
'type': 'docker',
'name': 'build_push',
'steps': steps,
'trigger': {
'branch': ['master'],
'event': ['push']
},
},
]
def steps_56():
s = []
for base in ['bullseye', 'buster']:
for variant in ['apache', 'cli', 'fpm']:
s.append(step_image('5.6', base, variant))
return s
def step_image(version, base, variant):
tag = '{}-{}-{}'.format(version, variant, base)
path = '{}/{}/{}'.format(version, base, variant)
return {
'name': tag,
'image': 'plugins/docker',
'settings': {
'context': path,
# https://github.com/drone-plugins/drone-docker/issues/335
'dockerfile': path + '/Dockerfile',
'tags': [tag],
'repo': {'from_secret': 'docker_repo'},
'username': {'from_secret': 'docker_username'},
'password': {'from_secret': 'docker_password'},
},
'depends_on': ['verify'],
}