-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathop.yml
More file actions
96 lines (91 loc) · 3.29 KB
/
op.yml
File metadata and controls
96 lines (91 loc) · 3.29 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
name: github.com/opspec-pkgs/docker.build.localimage
version: 1.2.0
description: |
Build a docker image in your host machines docker image store. Once a successful run of this op completes, you should see your new container created on the host machine when you run `docker images`.
Example usage:
```yml
op:
ref: github.com/opspec-pkgs/docker.build.localimage#1.2.0
inputs:
imageName: my-image
dockerfile: $(/Dockerfile)
dockerfileStage: my-stage-name
dockerSocket:
dockerConfig:
auths:
"https://index.docker.io/v1/":
auth: dXNlcm5hbWU6cGFzc3dvcmQK
```
```yml
op:
ref: github.com/opspec-pkgs/docker.build.localimage#1.2.0
inputs:
imageName: my-image
dockerfile: $(/Dockerfile)
dockerfileStage: my-stage-name
dockerSocket:
dockerConfig: $(HOME/.docker/config.json)
```
inputs:
dockerfile:
file:
description: |
The path the Dockerfile from which you will build the image or a directory containing one named `Dockerfile`.
default: .
dockerfileStage:
string:
description: |
The stage in your dockerfile to build (i.e. what `FROM` statement to build).
dockerSocket:
socket:
description: |
The socket path to the host machine's `dockerd` runtime socket.
For linux, you can try `netstat -lx | grep docker | grep -Po '/.*docker.sock'` to verify the proper socket file. For macOS, the default is `/var/run/docker.sock`.
dockerConfig:
object:
default: {}
description: |
The JSON of a docker configuration file. Use this to provide authentication to the docker registry.
Note that when using a credential helper (the default with macOS docker desktop) your default docker config at ~/.docker/config.json will not directly contain credentials. If you need to provide auth in this case, you'll need to generate a configuration file with base64 encoded credentials. See https://github.com/docker/for-mac/issues/4100 for more discussion on the format of this file.
constraints:
properties:
auths:
type: object
description: |
Keys are registry hostname/urls and values contain authentication information
additionalProperties:
type: object
properties:
auth:
description: Base64 encoded string of the format `{username}:{password}`
type: string
format: base64
imageName:
string:
description: |
The name (tag) of the built image. e.g. "container_name:latest".
run:
serial:
- op:
ref: github.com/opspec-pkgs/docker.config.clean#1.1.0
inputs:
dockerConfig:
outputs:
dockerConfigCleaned: $(dockerConfig)
- container:
image: { ref: 'docker:28.0.1-dind' }
files:
/Dockerfile: $(dockerfile)
/root/.docker/config.json: $(dockerConfig)
sockets:
/var/run/docker.sock: dockerSocket
cmd:
- sh
- -ce
- |
cat /Dockerfile | docker image build \
--progress plain \
--tag "$(imageName)" \
\$([ -z "$(dockerfileStage)" ] || printf -- "--target $(dockerfileStage)") \
-